handler

package
v0.23.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

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

func TCPHandler(b []byte) []byte

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL