Documentation ¶
Overview ¶
package multiplexer implements SSH and TLS multiplexing on the same listener
mux, _ := multiplexer.New(Config{Listener: listener}) mux.SSH() // returns listener getting SSH connections mux.TLS() // returns listener getting TLS connections
Index ¶
Constants ¶
const ( // ProtoUnknown is for unknown protocol ProtoUnknown = iota // ProtoTLS is TLS protocol ProtoTLS // ProtoSSH is SSH protocol ProtoSSH // ProtoProxy is a HAProxy proxy line protocol ProtoProxy )
const ( // TCP4 is TCP over IPv4 TCP4 = "TCP4" // TCP6 is tCP over IPv6 TCP6 = "TCP6" // Unknown is unsupported or unknown protocol UNKNOWN = "UNKNOWN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Listener is listener to multiplex connection on Listener net.Listener // Context is a context to signal stops, cancellations Context context.Context // ReadDeadline is a connection read deadline, // set to defaults.ReadHeadersTimeout if unspecified ReadDeadline time.Duration // Clock is a clock to override in tests, set to real time clock // by default Clock clockwork.Clock // EnableProxyProtocol enables proxy protocol EnableProxyProtocol bool }
Config is a multiplexer config
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults verifies configuration and sets defaults
type Conn ¶
Conn is a connection wrapper that supports communicating remote address from proxy protocol and replays first several bytes read during protocol detection
func (*Conn) RemoteAddr ¶
RemoteAddr returns remote address of the connection
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a listener that receives connections from multiplexer based on the connection type
type Mux ¶
Mux supports having both SSH and TLS on the same listener socket
func (*Mux) Serve ¶
Serve is a blocking function that serves on the listening socket and accepts requests. Every request is served in a separate goroutine
func (*Mux) Wait ¶
func (m *Mux) Wait()
Wait waits until listener shuts down and stops accepting new connections this is to workaround issue https://github.com/golang/go/issues/10527 in tests
type ProxyLine ¶
ProxyLine is HA Proxy protocol version 1 https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt Original implementation here: https://github.com/racker/go-proxy-protocol
func ReadProxyLine ¶
ReadProxyLine reads proxy line protocol from the reader