# Packages
Package sseclient implement HTTP client for Server-Sent Events (SSE).
# Functions
DefaultErrorHandler define the default function that will called to handle the error returned from [Callback] function, if the [Endpoint.ErrorHandler] is not defined.
GenerateFormData generate multipart/form-data body from params.
HandleRange handle [HTTP Range] request using "bytes" unit.
IPAddressOfRequest get the client IP address from HTTP request header "X-Real-IP" or "X-Forwarded-For", which ever non-empty first.
MarshalForm marshal struct fields tagged with `form:` into [url.Values].
NewClient create and initialize new [Client].
NewRange create new Range with specified unit.
NewServer create and initialize new HTTP server that serve root directory with custom connection.
ParseContentRange parse the HTTP header "Content-Range" value, as response from server, with the following format,
Content-Range = unit SP valid-range / invalid-range SP = " " valid-range = position "/" size invalid-range = "*" "/" size position = start "-" end size = 1*DIGIT / "*" start = 1*DIGIT end = 1*DIGIT
It will return nil if the v is invalid.
ParseMultipartRange parse "multipart/byteranges" response body.
ParseRange parses raw range value in the following format,
range = unit "=" position *("," position) unit = 1*VCHAR position = "-" last / start "-" / start "-" end last = 1*DIGIT start = 1*DIGIT end = 1*DIGIT
An invalid position will be skipped.
ParseResponseHeader parse HTTP response header and return it as standard HTTP Response with unreaded packet.
ParseXForwardedFor parse the HTTP header "X-Forwarded-For" value from the following format "client, proxy1, proxy2" into client address and list of proxy addressess.
UnmarshalForm read struct fields tagged with `form:` from out as key and set its using the value from [url.Values] based on that key.
# Constants
List of header value for HTTP header Accept-Ranges.
List of header value for HTTP header Accept-Ranges.
List of known "Content-Encoding" header values.
Using LZW.
Using zlib.
List of known "Content-Encoding" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
List of known "Content-Type" header values.
DefRangeLimit limit of content served by server when [Range] request without end, in example "0-".
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
List of known header names.
https://en.wikipedia.org/wiki/X-Forwarded-For.
revive:disable-line.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of known HTTP methods.
List of valid request type.
List of valid request type.
List of valid request type.
List of valid request type.
List of valid request type.
List of valid request type.
List of valid response type.
List of valid response type.
List of valid response type.
List of valid response type.
List of valid response type.
List of valid response type.
# Variables
ErrClientDownloadNoOutput define an error when Client's DownloadRequest does not define the Output.
ErrEndpointAmbiguous define an error when registering path that already exist.
# Structs
Client is a wrapper for standard [http.Client] with simplified usabilities, including setting default headers, uncompressing response body.
ClientOptions options for HTTP client.
ClientRequest define the parameters for each Client methods.
CORSOptions define optional options for server to allow other servers to access its resources.
DownloadRequest define the parameter for [Client.Download] method.
Endpoint represent route that will be handled by server.
EndpointRequest wrap the called [Endpoint] and common two parameters in HTTP handler: the [http.ResponseWriter] and [http.Request].
EndpointResponse is one of the common HTTP response container that can be used by Server implementor.
Range define the unit and list of start-end positions for resource.
RangePosition contains the parsed value of Content-Range header.
Server define HTTP server.
ServerOptions define an options to initialize HTTP server.
SSEConn define the connection when the SSE request accepted by server.
SSEEndpoint endpoint to create Server-Sent Events (SSE) on server.
# Type aliases
Callback define a type of function for handling registered handler.
CallbackErrorHandler define the function that can be used to handle an error returned from [Endpoint.Call].
Evaluator evaluate the request.
FSHandler define the function to inspect each GET request to Server [memfs.MemFS] instance.
RequestMethod define type of HTTP method.
RequestType define type of HTTP request.
ResponseType define type for HTTP response.
SSECallback define the handler for Server-Sent Events (SSE).