Documentation ¶
Overview ¶
Package httpweave provides a http layer for communicate with a low-level tcp server through http requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosedConnection = errors.New("Connection Closed")
ErrClosedConnection is returned when the giving client connection has being closed.
Functions ¶
This section is empty.
Types ¶
type TCPClient ¶
TCPClient defines a interface for a type which connects to a tcp endpoint and provides read and write capabilities.
func NewTCPClient ¶
NewTCPClient returns a new instance of a TCPClient.
func (*TCPClient) Close ¶
Close ends and disposes of the internal connection, closing it and all reads and writers.
type WeaveAttr ¶
type WeaveAttr struct { Addr string TargetAddr string Headers http.Header Transformer octo.TCPTransformer Auth octo.Authenticator TLSConfig *tls.Config TCPTLSConfig *tls.Config Notifications chan []byte }
WeaveAttr defines a attribute struct for defining options for the WebWeaveServer struct.
type WeaveServer ¶
type WeaveServer struct { Attr WeaveAttr // contains filtered or unexported fields }
WeaveServer defines a struct implements the http.ServeHTTP interface which handles servicing http requests for websockets.
func New ¶
func New(instrument octo.Instrumentation, attr WeaveAttr) *WeaveServer
New returns a new instance of a WeaveServer.
func (*WeaveServer) Close ¶
func (s *WeaveServer) Close() error
Close ends the websocket connection and ensures all requests are finished.
func (*WeaveServer) Listen ¶
func (s *WeaveServer) Listen() error
Listen begins the initialization of the websocket server.
func (*WeaveServer) ServeHTTP ¶
func (s *WeaveServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler.ServeHTTP interface method to handle http request converted to websockets request.
func (*WeaveServer) Wait ¶
func (s *WeaveServer) Wait()
Wait awaits the closure of the giving client.
type WeaveServerMux ¶
type WeaveServerMux struct { Attr WeaveAttr OverrideTargetAddr string // targetAddr to be used regardless of incoming data from client. // contains filtered or unexported fields }
WeaveServerMux defines a struct which implements the http.Handler interface for handling http server-sent requests.
func NewWeaveServerMux ¶
func NewWeaveServerMux(instruments octo.Instrumentation, auth octo.Authenticator, transfomer octo.TCPTransformer, info octo.Contact, targetAddr string, config *tls.Config) *WeaveServerMux
NewWeaveServerMux returns a new instance of a WeaveServerMux which will use the provided targetAddr if provided as destination else use that from the incoming data from the request.
func (*WeaveServerMux) ServeHTTP ¶
func (s *WeaveServerMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler.ServeHTTP interface method to handle http request converted to websockets request.