Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPHandler ¶
func HTTPHandler(w http.ResponseWriter, r *http.Request)
HTTPHandler handles HTTP requests and sends back HTTP responses. It processes incoming HTTP requests, creates a corresponding transport request, and uses the router to generate a response. The handler deals with various HTTP methods, reads request bodies if necessary, and writes back responses including headers and status codes.
Parameters: - w: http.ResponseWriter Response writer to send back the HTTP response. - r: *http.Request The incoming HTTP request to be processed.
func TCPHandler ¶
TCPHandler handles TCP requests by unmarshalling, processing, and marshalling responses. It is responsible for converting raw byte data into a structured request, processing it using a router, and then returning the structured response as byte data. It handles errors at each step by returning an empty response in case of failure.
Parameters: - b: []byte Raw byte array representing a TCP request.
Returns: - []byte: Processed response as a byte array. Returns an empty response in case of errors.
Types ¶
This section is empty.