server

package
v0.0.0-...-c4d2918 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerConfigHost         = "unix:///var/run/docker.sock"
	DockerAPIVersion         = "1.24"
	DockerRouterLabelHost    = "mc-router.host"
	DockerRouterLabelPort    = "mc-router.port"
	DockerRouterLabelDefault = "mc-router.default"
	DockerRouterLabelNetwork = "mc-router.network"
)
View Source
const (
	AnnotationExternalServerName = "mc-router.itzg.me/externalServerName"
	AnnotationDefaultServer      = "mc-router.itzg.me/defaultServer"
)

Variables

View Source
var Routes = NewRoutes()
View Source
var RoutesConfig = &routesConfigImpl{}

Functions

func StartApiServer

func StartApiServer(apiBinding string)

Types

type Connector

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

func NewConnector

func NewConnector(metrics *ConnectorMetrics, sendProxyProto bool) *Connector

func (*Connector) HandleConnection

func (c *Connector) HandleConnection(ctx context.Context, frontendConn net.Conn)

func (*Connector) StartAcceptingConnections

func (c *Connector) StartAcceptingConnections(ctx context.Context, listenAddress string, connRateLimit int) error

func (*Connector) UseNgrok

func (c *Connector) UseNgrok(token string)

func (*Connector) WaitForConnections

func (c *Connector) WaitForConnections()

type ConnectorMetrics

type ConnectorMetrics struct {
	Errors            metrics.Counter
	BytesTransmitted  metrics.Counter
	Connections       metrics.Counter
	ActiveConnections metrics.Gauge
}

type IDockerWatcher

type IDockerWatcher interface {
	StartInSwarm(timeoutSeconds int, refreshIntervalSeconds int) error
	Stop()
}
var DockerWatcher IDockerWatcher = &dockerWatcherImpl{}

type IK8sWatcher

type IK8sWatcher interface {
	StartWithConfig(kubeConfigFile string, autoScaleUp bool) error
	StartInCluster(autoScaleUp bool) error
	Stop()
}
var K8sWatcher IK8sWatcher = &k8sWatcherImpl{}

type IRoutes

type IRoutes interface {
	Reset()
	RegisterAll(mappings map[string]string)
	// FindBackendForServerAddress returns the host:port for the external server address, if registered.
	// Otherwise, an empty string is returned. Also returns the normalized version of the given serverAddress.
	// The 3rd value returned is an (optional) "waker" function which a caller must invoke to wake up serverAddress.
	FindBackendForServerAddress(ctx context.Context, serverAddress string) (string, string, func(ctx context.Context) error)
	GetMappings() map[string]string
	DeleteMapping(serverAddress string) bool
	CreateMapping(serverAddress string, backend string, waker func(ctx context.Context) error)
	SetDefaultRoute(backend string)
	SimplifySRV(srvEnabled bool)
}

func NewRoutes

func NewRoutes() IRoutes

type IRoutesConfig

type IRoutesConfig interface {
	ReadRoutesConfig(routesConfig string)
	AddMapping(serverAddress string, backend string)
	DeleteMapping(serverAddress string)
	SetDefaultRoute(backend string)
}

Jump to

Keyboard shortcuts

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