listener

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateListener

func ActivateListener(newConfig ListenerConfiguration)

ActivateListener activates the lister matched by port and copy the configuration passed in. Enabled upstreams are keptd intact if the lister already exist in the current map of listeners.

func Listeners

func Listeners() map[int]Listener

Listeners return a copy of the listeners in the current state

func SetEnabledUpstreams

func SetEnabledUpstreams(listenerPort int, upstreamsToEnable []string)

SetEnabledUpstreams sets the array of upstreams that are enabled for a specific listener

func SetListeners

func SetListeners(listenersToSet map[int]Listener)

SetListeners reset the current listeners to a new state

func StartListening

func StartListening(configurations []ListenerConfiguration)

StartListening initializes all the listeners and bind them to the specified ports

Types

type Listener

type Listener struct {
	Active           bool                  `json:"active"`
	Configuration    ListenerConfiguration `json:"configuration"`
	EnabledUpstreams []string              `json:"enabledUpstreams"`
}

Listener represents a listener that responds to incoming requests

type ListenerConfiguration

type ListenerConfiguration struct {
	CertificateFile string `json:"certificateFile"`
	KeyFile         string `json:"keyFile"`
	Name            string `json:"name"`
	Port            int    `json:"port"`
}

ListenerConfiguration store the configuration to create a listener

func ParseListenerConfigurations

func ParseListenerConfigurations() []ListenerConfiguration

ParseListenerConfigurations reads environment variables and parses the relevant keys to create the configurations

Jump to

Keyboard shortcuts

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