tcp

package
v2.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn added in v2.7.0

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.
	tcp.WriteCloser
}

Conn is a connection proxy that handles Peeked bytes.

func (*Conn) Read added in v2.7.0

func (c *Conn) Read(p []byte) (n int, err error)

Read reads bytes from the connection (using the buffer prior to actually reading).

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a route/router manager.

func NewManager

func NewManager(conf *runtime.Configuration,
	serviceManager *tcpservice.Manager,
	middlewaresBuilder middlewareBuilder,
	httpHandlers map[string]http.Handler,
	httpsHandlers map[string]http.Handler,
	tlsManager *traefiktls.Manager,
) *Manager

NewManager Creates a new Manager.

func (*Manager) BuildHandlers

func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) map[string]*Router

BuildHandlers builds the handlers for the given entrypoints.

type Router added in v2.7.0

type Router struct {
	// contains filtered or unexported fields
}

Router is a TCP router.

func NewRouter added in v2.7.0

func NewRouter() (*Router, error)

NewRouter returns a new TCP router.

func (*Router) AddHTTPTLSConfig added in v2.7.0

func (r *Router) AddHTTPTLSConfig(sniHost string, config *tls.Config)

AddHTTPTLSConfig defines a handler for a given sniHost and sets the matching tlsConfig.

func (*Router) AddRoute added in v2.7.0

func (r *Router) AddRoute(rule string, priority int, target tcp.Handler) error

AddRoute defines a handler for the given rule.

func (*Router) GetConn added in v2.7.0

func (r *Router) GetConn(conn tcp.WriteCloser, peeked string) tcp.WriteCloser

GetConn creates a connection proxy with a peeked string.

func (*Router) GetHTTPHandler added in v2.7.0

func (r *Router) GetHTTPHandler() http.Handler

GetHTTPHandler gets the attached http handler.

func (*Router) GetHTTPSHandler added in v2.7.0

func (r *Router) GetHTTPSHandler() http.Handler

GetHTTPSHandler gets the attached https handler.

func (*Router) GetTLSGetClientInfo added in v2.7.0

func (r *Router) GetTLSGetClientInfo() func(info *tls.ClientHelloInfo) (*tls.Config, error)

GetTLSGetClientInfo is called after a ClientHello is received from a client.

func (*Router) ServeTCP added in v2.7.0

func (r *Router) ServeTCP(conn tcp.WriteCloser)

ServeTCP forwards the connection to the right TCP/HTTP handler.

func (*Router) SetHTTPForwarder added in v2.7.0

func (r *Router) SetHTTPForwarder(handler tcp.Handler)

SetHTTPForwarder sets the tcp handler that will forward the connections to an http handler.

func (*Router) SetHTTPHandler added in v2.7.0

func (r *Router) SetHTTPHandler(handler http.Handler)

SetHTTPHandler attaches http handlers on the router.

func (*Router) SetHTTPSForwarder added in v2.7.0

func (r *Router) SetHTTPSForwarder(handler tcp.Handler)

SetHTTPSForwarder sets the tcp handler that will forward the TLS connections to an HTTP handler. It also sets up each TLS handler (with its TLS config) for each Host(SNI) rule we previously kept track of. It sets up a special handler that closes the connection if a TLS config is nil.

func (*Router) SetHTTPSHandler added in v2.7.0

func (r *Router) SetHTTPSHandler(handler http.Handler, config *tls.Config)

SetHTTPSHandler attaches https handlers on the router.

Jump to

Keyboard shortcuts

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