iface

package
v0.3.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientGone = errors.New("client no longer registered with backend")

ErrClientGone is returned by Backend.SendData when the target client is no longer registered with the backend (e.g. EventDisconnect already arrived). Callers use this sentinel to suppress error-level logging on forward read loops, since this is expected race noise during normal teardown rather than a real failure.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	ID() string
	// AddClient associates a client connection and informs the backend about it.
	// The hostname indicates which virtual host this client targets.
	AddClient(clientConn net.Conn, clientID uuid.UUID, hostname string, isTLS bool) error
	RemoveClient(clientID uuid.UUID)
	SendData(clientID uuid.UUID, data []byte) error
	// HasRecentActivity reports whether data has been written to the given
	// client since the specified time. Used by the idle timeout logic to
	// avoid killing connections during active downloads.
	HasRecentActivity(clientID uuid.UUID, since time.Time) bool
}

Backend represents a single connection from a backend service.

type Hub

type Hub interface {
	GetLocalRoutes() []string
	SelectBackend(hostname string) (Backend, error)
	UDPFlowIdleTimeout(port int) (time.Duration, bool)
	GetBandwidthScheduler() *bandwidth.Scheduler
}

Hub is an interface that components use to interact with the backend hub.

type Peer

type Peer interface {
	Addr() string
	Send(message []byte) bool
	StartTunnel(conn net.Conn, hostname string, isTLS bool)
}

Peer represents a single connection to another Nexus node.

type PeerManager

type PeerManager interface {
	HandleInboundPeer(conn *websocket.Conn)
	AnnounceLocalRoutes()
	GetPeerForHostname(hostname string) (Peer, bool)
	HandleTunnelRequest(p Peer, hostname string, clientID uuid.UUID, clientIP string, connPort int, isTLS bool)
	ForwardUDP(routeKey string, dstPort int, pc net.PacketConn, clientAddr *net.UDPAddr, payload []byte) error
}

PeerManager is an interface that components use to interact with the peer manager.

Jump to

Keyboard shortcuts

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