gateway

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceAlreadyRegistered = errors.New("gateway: service already registered")
	ErrServiceNotFound          = errors.New("gateway: service not found")
	ErrExtraDataNotAllowed      = errors.New("gateway: extra data not allowed")
	ErrUnknownChannelType       = errors.New("gateway: unknown channel type")
	ErrPermissionDenied         = errors.New("gateway: permission denied")
)
View Source
var (
	ErrInvalidCommand = errors.New("gateway: invalid command")
	ErrNotFound       = errors.New("gateway: not found")
)
View Source
var (
	ErrInvalidForwardRequest = errors.New("gateway: invalid forward request")
	ErrInvalidTunnelData     = errors.New("gateway: invalid tunnel data")
)

Functions

This section is empty.

Types

type Gateway

type Gateway interface {
	Close()

	HandleConnection(net.Conn)
	HandleSocksConnection(net.Conn)
	HTTPProxyHandler() http.Handler
	ScavengeConnections(time.Duration)

	ListUsers(context.Context) (interface{}, error)
	ListOnlineUsers(context.Context) (interface{}, error)
	ListLocalOnlineUsers(context.Context) (interface{}, error)
	GetUser(context.Context, string) (interface{}, error)
	GetUserScreenshot(context.Context, string) ([]byte, error)
}

an instance of gateway, contains runtime states

func Open

func Open(database db.Database, sshConfig *ssh.ServerConfig, settings *Settings) (Gateway, error)

creates a new instance of gateway

type Settings

type Settings struct {
	// version string
	Version string

	// id of this node, empty disables node registration and mesh tunneling
	NodeID string

	// address where peer nodes can reach this node, empty means other nodes
	// cannot dial this node
	NodeAddress string

	// host public key of this node, published to the node table so dialing
	// peers can pin it
	HostPublicKey ssh.PublicKey

	// certificate signer used to authenticate to other nodes, a user
	// certificate signed by the peer certificate authority with the "peer"
	// principal and the node id as key id, nil disables outbound peering
	NodeSigner ssh.Signer

	// address of the local postgres database bridged for peer nodes, empty
	// refuses postgres tunnels
	PostgresAddress string

	// how often to look for new peer nodes and refresh this node's online
	// heartbeat, defaults to 15 seconds; must stay well below
	// onlineStaleThreshold or other nodes will consider this node dead
	PeerDiscoveryInterval time.Duration

	// revokes a user's cached login flags on this node, called by kickUser
	// so a kicked user's next login re-reads the database, optional
	RevokeLoginFlags func(userId string)
}

Jump to

Keyboard shortcuts

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