hub

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *config.Config, tlsConfig *tls.Config, validator auth.Validator, outboundClient *http.Client) *hubImpl

New creates and returns a new Hub instance.

Types

type AttestationMetadata

type AttestationMetadata struct {
	Hostnames            []string
	TCPPorts             []int
	UDPRoutes            []UDPRoutePolicy
	Weight               int
	ReauthInterval       time.Duration
	ReauthGrace          time.Duration
	MaintenanceCap       time.Duration
	HasMaintenanceCap    bool
	AuthorizerStatusURI  string
	PolicyVersion        string
	OutboundAllowed      bool
	AllowedOutboundPorts []int
}

AttestationMetadata captures the policy directives extracted from the attested token that Nexus must enforce for a backend connection.

type Backend

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

Backend represents a single, authenticated WebSocket connection from a backend service.

func NewBackend

func NewBackend(conn *websocket.Conn, meta *AttestationMetadata, cfg *config.Config, validator auth.Validator, httpClient *http.Client) *Backend

NewBackend creates a new Backend instance.

func (*Backend) AddClient

func (b *Backend) AddClient(clientConn net.Conn, clientID uuid.UUID, hostname string, isTLS bool) error

func (*Backend) AddOutboundClient added in v0.3.1

func (b *Backend) AddOutboundClient(conn net.Conn, clientID uuid.UUID) error

AddOutboundClient stores a proxy-dialed outbound connection in the clients map. Unlike AddClient, it does not send EventConnect (the backend initiated the request and already knows about the connection).

func (*Backend) Close

func (b *Backend) Close()

func (*Backend) ID

func (b *Backend) ID() string

func (*Backend) RemoveClient

func (b *Backend) RemoveClient(clientID uuid.UUID)

func (*Backend) SendControlMessage

func (b *Backend) SendControlMessage(msg protocol.ControlMessage) error

func (*Backend) SendData

func (b *Backend) SendData(clientID uuid.UUID, data []byte) error

func (*Backend) StartPumps

func (b *Backend) StartPumps()

type LoadBalancerPool

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

LoadBalancerPool manages a collection of backend instances for a single hostname.

func NewLoadBalancerPool

func NewLoadBalancerPool() *LoadBalancerPool

NewLoadBalancerPool creates a new, empty load balancer pool.

func (*LoadBalancerPool) AddBackend

func (p *LoadBalancerPool) AddBackend(b *Backend)

func (*LoadBalancerPool) HasBackends

func (p *LoadBalancerPool) HasBackends() bool

HasBackends returns true if there are one or more backends in the pool.

func (*LoadBalancerPool) RemoveBackend

func (p *LoadBalancerPool) RemoveBackend(b *Backend)

func (*LoadBalancerPool) Select

func (p *LoadBalancerPool) Select() (iface.Backend, error)

Select chooses a backend from the pool using the Weighted Round Robin algorithm. It returns an error if no backends are available.

type UDPRoutePolicy

type UDPRoutePolicy struct {
	Port            int
	FlowIdleTimeout time.Duration
}

Jump to

Keyboard shortcuts

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