supervisor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PQKex     = tls.CurveID(0xfe31) // X25519Kyber768Draft00
	PQKexName = "X25519Kyber768Draft00"
)

Variables

This section is empty.

Functions

func NewIPAddrFallback

func NewIPAddrFallback(maxRetries uint8) *ipAddrFallback

func NewTunnelsForHA

func NewTunnelsForHA() tunnelsForHA

NewTunnelsForHA initializes the Prometheus metrics etc for a tunnelsForHA.

func StartTunnelDaemon

func StartTunnelDaemon(
	ctx context.Context,
	config *TunnelConfig,
	orchestrator *orchestration.Orchestrator,
	connectedSignal *signal.Signal,
	reconnectCh chan ReconnectSignal,
	graceShutdownC <-chan struct{},
) error

Types

type ConnAwareLogger

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

func NewConnAwareLogger

func NewConnAwareLogger(logger *zerolog.Logger, tracker *tunnelstate.ConnTracker, observer *connection.Observer) *ConnAwareLogger

func (*ConnAwareLogger) ConnAwareLogger

func (c *ConnAwareLogger) ConnAwareLogger() *zerolog.Event

func (*ConnAwareLogger) Logger

func (c *ConnAwareLogger) Logger() *zerolog.Logger

func (*ConnAwareLogger) ReplaceLogger

func (c *ConnAwareLogger) ReplaceLogger(logger *zerolog.Logger) *ConnAwareLogger

type ConnectivityError

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

func NewConnectivityError

func NewConnectivityError(hasReachedMaxRetries bool) *ConnectivityError

func (*ConnectivityError) Error

func (e *ConnectivityError) Error() string

func (*ConnectivityError) HasReachedMaxRetries

func (e *ConnectivityError) HasReachedMaxRetries() bool

type EdgeAddrHandler

type EdgeAddrHandler interface {
	// ShouldGetNewAddress will check the edge connection error and determine if
	// the edge address should be replaced with a new one. Also, will return if the
	// error should be recognized as a connectivity error, or otherwise, a general
	// application error.
	ShouldGetNewAddress(connIndex uint8, err error) (needsNewAddress bool, connectivityError error)
}

EdgeAddrHandler provides a mechanism switch between behaviors in ServeTunnel for handling the errors when attempting to make edge connections.

type EdgeTunnelServer

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

func (*EdgeTunnelServer) Serve

func (e *EdgeTunnelServer) Serve(ctx context.Context, connIndex uint8, protocolFallback *protocolFallback, connectedSignal *signal.Signal) error

type Incident

type Incident struct {
	Name    string
	ID      string           `json:"id"`
	Updates []IncidentUpdate `json:"incident_updates"`
}

func (Incident) URL

func (i Incident) URL() string

type IncidentLookup

type IncidentLookup interface {
	ActiveIncidents() []Incident
}

IncidentLookup is an object that checks for active incidents in the Khulnasoft infrastructure.

func NewIncidentLookup

func NewIncidentLookup() IncidentLookup

NewIncidentLookup returns a new IncidentLookup instance that caches its results with a 1-minute TTL.

type IncidentUpdate

type IncidentUpdate struct {
	Body string
}

type ReconnectSignal

type ReconnectSignal struct {
	// wait this many seconds before re-establish the connection
	Delay time.Duration
}

func (ReconnectSignal) DelayBeforeReconnect

func (r ReconnectSignal) DelayBeforeReconnect()

func (ReconnectSignal) Error

func (r ReconnectSignal) Error() string

Error allows us to use ReconnectSignal as a special error to force connection abort

type StatusPage

type StatusPage struct {
	Incidents []Incident
}

type Supervisor

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

Supervisor manages non-declarative tunnels. Establishes TCP connections with the edge, and reconnects them if they disconnect.

func NewSupervisor

func NewSupervisor(config *TunnelConfig, orchestrator *orchestration.Orchestrator, reconnectCh chan ReconnectSignal, gracefulShutdownC <-chan struct{}) (*Supervisor, error)

func (*Supervisor) Run

func (s *Supervisor) Run(
	ctx context.Context,
	connectedSignal *signal.Signal,
) error

type TunnelConfig

type TunnelConfig struct {
	GracePeriod        time.Duration
	ReplaceExisting    bool
	OSArch             string
	ClientID           string
	CloseConnOnce      *sync.Once // Used to close connectedSignal no more than once
	EdgeAddrs          []string
	Region             string
	EdgeIPVersion      allregions.ConfigIPVersion
	EdgeBindAddr       net.IP
	HAConnections      int
	IncidentLookup     IncidentLookup
	IsAutoupdated      bool
	LBPool             string
	Tags               []tunnelpogs.Tag
	Log                *zerolog.Logger
	LogTransport       *zerolog.Logger
	Observer           *connection.Observer
	ReportedVersion    string
	Retries            uint
	MaxEdgeAddrRetries uint8
	RunFromTerminal    bool

	NeedPQ bool

	NamedTunnel      *connection.NamedTunnelProperties
	ProtocolSelector connection.ProtocolSelector
	EdgeTLSConfigs   map[connection.Protocol]*tls.Config
	PacketConfig     *ingress.GlobalRouterConfig

	UDPUnregisterSessionTimeout time.Duration

	DisableQUICPathMTUDiscovery bool

	FeatureSelector *features.FeatureSelector
}

func (*TunnelConfig) SupportedFeatures

func (c *TunnelConfig) SupportedFeatures() []string

type TunnelServer

type TunnelServer interface {
	Serve(ctx context.Context, connIndex uint8, protocolFallback *protocolFallback, connectedSignal *signal.Signal) error
}

Jump to

Keyboard shortcuts

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