package
0.0.0-20231218105451-36bff570fdd9
Repository: https://github.com/johnietre/jtrpc.git
Documentation: pkg.go.dev

# Functions

CombineMiddleware combines multiple middlewares into one.
Dial attempts to connect to a server with the given address using TCP.
FromHTTPHeader takes an http.Header and returns a parsed Headers.
FromHTTPHeaderP, to be concise, is to FromHTTPHeader what Encode is to EncodeP.
FromReader creates a new ReadCloseCounter from an io.Reader and length.
GetFirstValue returns the first value in a list of values, or an empty string if there are no values.
GetHTTPRequest returns the http.Request the jtrpc.Request was created from, if there was one.
GetLastValue returns the last value in a list of values, or an empty string if there are no values.
GetStreamClosedError attempts to convert the error into a *StreamClosedError using errors.As, returning nil if the conversion fails.
IsStreamClosedError returns whether the error is a StreamClosedError.
JoinValues joins the values with ",".
NewHeaders creates a new Headers.
NewMapMux creates a new MapMux.
No description provided by the author
NewRequest creates a new request.
NewServer creates a new server.
RequestFromReader reads a requests from the reader and returns it.
StatusToHTTP converts a status to its closest HTTP-equivalent status.
WithRW attempts to set up a connection using the given reader and writer.

# Constants

DefaultConnectTimeout is the default connect timeout.
DefaultMaxBodyLen is the default max body length for requests.
DefaultMaxStreamBodyLen is the default max body length for stream messages.
FlagStreamMsg signifies a stream message.
MaxHeadersLen is the maximum number of headers bytes that can be sent.
MsgFlagClose signifies the stream should (will) be closed.
MsgFlagNotStream signfies the requested path is not a stream.
MsgFlagTooLarge signifies the message was too large.
ReqFlagCancel signifies the request is to cancel a prior request with the same ID.
ReqFlagStream signifies a request expects a stream.
ReqFlagTimeout signifies a request has a timeout.
StatusBadRequest is a BadRequest status code.
StatusBadVersion is a BadVersion status code.
StatusBodyTooLarge is a BodyTooLarge status code.
StatusInternalServerError is an InternalServerError status code.
StatusInvalidInitialBytes is an InvalidInitialBytes status code.
StatusIsStream is an IsStream status code.
StatusNotFound is a NotFound status code.
StatusNotStream is a NotStream status code.
Non-Errors */ StatusOK is an OK status code.
StatusPartialError is a PartialError status code.
StatusUnauthorized is an Unauthorized status code.

# Variables

ErrBodyTooLarge means a body was too large.
No description provided by the author
ErrHeadersTooLarge means the headers are too large to encode.
ErrTimedOut means an operation timed out.

# Structs

Client is a JtRPC client.
ClientClosedError is the error returned when a client is closed.
CloserWrapper wrappers an io.Reader to give it a noop Close method to conform with io.ReadCloser.
ErrorResp is a wrapper around a Response to make it conform to the error interface.
Headers represents request headers that may or may not be parsed.
MapMux is the defualt multiplexer used by the server.
Message is a message sent/received to/from a stream.
ReadCloseCounter is a wrapper around an io.ReadCloser that keeps track of how many bytes are left in the reader.
Request is a request received.
RespChan is used to return a response to a client or cancel the request.
Response is a response to be sent.
Server is a server.
Stream represents a stream.
StreamClosedError represents an error due to the stream being closed.
UnimplementedMux implements the Mux interface and may be useful for embedding.

# Interfaces

Handler is a handler for request/responses.
Mux is the multiplexer used for handling request paths.
StreamHandler is a handler for streams.

# Type aliases

HandlerFunc is a function that implements the Handler interface.
Middleware is middleware.
StreamHandlerFunc is a function that implements the StreamHandler interface.