Documentation ¶
Index ¶
- type Config
- type Dialer
- type Frontend
- type ListenConfig
- type Mux
- func (m *Mux) AddFrontend(f Frontend) error
- func (m *Mux) AddFrontends(frontends ...Frontend) error
- func (m *Mux) DefaultFrontend() *Frontend
- func (m *Mux) ExistingFrontends() map[string]*Frontend
- func (m *Mux) HasFrontend(host string) bool
- func (m *Mux) RemoveFrontend(host string) error
- func (m *Mux) Run() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ListenAddr is the underlying listener address ListenAddr string }
Config is Mux configuration parameters
type Frontend ¶
type Frontend struct { // Host is SNI host,used for routing Host string // Name is Frontend name, used to identify frontends Name string // Dial if present, used to dial the remote location Dial Dialer // Default controls if the default location is set with no SNI routes matched Default bool // contains filtered or unexported fields }
Frontend is a mux Frontend either web handler or remote dialer
type ListenConfig ¶
type ListenConfig struct { // ListenAddr is the SNI listener address ListenAddr string // Frontends is the list of frontends to initialize SNI mux with Frontends []Frontend }
ListenConfig is the SNI mux configuration
type Mux ¶
type Mux struct { sync.RWMutex Config logrus.FieldLogger // contains filtered or unexported fields }
Mux is SNI multiplexer
func Listen ¶
func Listen(config ListenConfig) (*Mux, error)
Listen creates a new SNI mux that listens on the specified address, starts it and adds all provided frontends to it. Returns the created mux
func (*Mux) AddFrontend ¶
AddFrontend adds frontend, returns error if SNI Host route already exists
func (*Mux) AddFrontends ¶
AddFrontends adds multiple SNI frontends
func (*Mux) DefaultFrontend ¶
DefaultFrontend returns default frontend, nil if not set
func (*Mux) ExistingFrontends ¶
ExistingFrontends returns map of existing frontends, read only
func (*Mux) HasFrontend ¶
HasFrontend returns true if there's a frontend matching given SNI host
func (*Mux) RemoveFrontend ¶
RemoveFrontend removes frontend by SNI Host name