Documentation ¶
Index ¶
- type Conn
- type Handler
- type HandlerFunc
- type HandlerSwitcher
- type Proxy
- type RRLoadBalancer
- type Router
- func (r *Router) AddCatchAllNoTLS(handler Handler)
- func (r *Router) AddRoute(sniHost string, target Handler)
- func (r *Router) AddRouteHTTPTLS(sniHost string, config *tls.Config)
- func (r *Router) AddRouteTLS(sniHost string, target Handler, config *tls.Config)
- func (r *Router) GetConn(conn net.Conn, peeked string) net.Conn
- func (r *Router) GetHTTPHandler() http.Handler
- func (r *Router) GetHTTPSHandler() http.Handler
- func (r *Router) HTTPForwarder(handler Handler)
- func (r *Router) HTTPHandler(handler http.Handler)
- func (r *Router) HTTPSForwarder(handler Handler)
- func (r *Router) HTTPSHandler(handler http.Handler, config *tls.Config)
- func (r *Router) ServeTCP(conn net.Conn)
- type TLSHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { // Peeked are the bytes that have been read from Conn for the // purposes of route matching, but have not yet been consumed // by Read calls. It set to nil by Read when fully consumed. Peeked []byte // Conn is the underlying connection. // It can be type asserted against *net.TCPConn or other types // as needed. It should not be read from directly unless // Peeked is nil. net.Conn }
Conn is a connection proxy that handles Peeked bytes
type HandlerFunc ¶
The HandlerFunc type is an adapter to allow the use of ordinary functions as handlers.
type HandlerSwitcher ¶
type HandlerSwitcher struct {
// contains filtered or unexported fields
}
HandlerSwitcher is a TCP handler switcher
func (*HandlerSwitcher) ServeTCP ¶
func (s *HandlerSwitcher) ServeTCP(conn net.Conn)
ServeTCP forwards the TCP connection to the current active handler
func (*HandlerSwitcher) Switch ¶
func (s *HandlerSwitcher) Switch(handler Handler)
Switch sets the new TCP handler to use for new connections
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy forwards a TCP request to a TCP service
type RRLoadBalancer ¶
type RRLoadBalancer struct {
// contains filtered or unexported fields
}
RRLoadBalancer is a naive RoundRobin load balancer for TCP services
func NewRRLoadBalancer ¶
func NewRRLoadBalancer() *RRLoadBalancer
NewRRLoadBalancer creates a new RRLoadBalancer
func (*RRLoadBalancer) AddServer ¶
func (r *RRLoadBalancer) AddServer(server Handler)
AddServer appends a server to the existing list
func (*RRLoadBalancer) ServeTCP ¶
func (r *RRLoadBalancer) ServeTCP(conn net.Conn)
ServeTCP forwards the connection to the right service
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a TCP router
func (*Router) AddCatchAllNoTLS ¶
AddCatchAllNoTLS defines the fallback tcp handler
func (*Router) AddRoute ¶
AddRoute defines a handler for a given sniHost (* is the only valid option)
func (*Router) AddRouteHTTPTLS ¶
AddRouteHTTPTLS defines a handler for a given sniHost and sets the matching tlsConfig
func (*Router) AddRouteTLS ¶
AddRouteTLS defines a handler for a given sniHost and sets the matching tlsConfig
func (*Router) GetHTTPHandler ¶
GetHTTPHandler gets the attached http handler
func (*Router) GetHTTPSHandler ¶
GetHTTPSHandler gets the attached https handler
func (*Router) HTTPForwarder ¶
HTTPForwarder sets the tcp handler that will forward the connections to an http handler
func (*Router) HTTPHandler ¶
HTTPHandler attaches http handlers on the router
func (*Router) HTTPSForwarder ¶
HTTPSForwarder sets the tcp handler that will forward the TLS connections to an http handler
func (*Router) HTTPSHandler ¶
HTTPSHandler attaches https handlers on the router
type TLSHandler ¶
TLSHandler handles TLS connections
func (*TLSHandler) ServeTCP ¶
func (t *TLSHandler) ServeTCP(conn net.Conn)
ServeTCP terminates the TLS connection