tunnel_server

package
v0.46.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TunnelLifecycleLogHook func(userId, username, tunnelLabel string, opened bool)

TunnelLifecycleLogHook is called when a tunnel opens or closes, so the pro build can mirror the lifecycle into the owner's log sinks (the audit events cover the audit trail; sinks only ever see log records). The OSS build leaves it nil.

View Source
var TunnelRequestLogHook func(userId, username, tunnelName, method, path, host string, status int, duration time.Duration)

TunnelRequestLogHook is called after each request proxied through a web tunnel, carrying the tunnel owner and the request outcome. The pro build assigns it (system-log forwarding + log-sink mirroring); the OSS build leaves it nil and tunnel requests are unlogged.

Functions

func CountUserTunnels added in v0.12.3

func CountUserTunnels(userId string) uint32

func DeleteTunnel added in v0.15.2

func DeleteTunnel(userId, tunnelName string) error

func GetTunnelsForUser added in v0.12.7

func GetTunnelsForUser(userId string) []string

func HandleCreatePortTunnel added in v0.18.0

func HandleCreatePortTunnel(w http.ResponseWriter, r *http.Request, muxSession *yamux.Session, agentSessionId string, port uint16, space *model.Space, user *model.User) error

func HandleTunnel

func HandleTunnel(w http.ResponseWriter, r *http.Request)

func HandleWebTunnel added in v0.19.0

func HandleWebTunnel(w http.ResponseWriter, r *http.Request)

HandleWebTunnel handles web tunnel requests for domain-based routing

func ListenAndServe

func ListenAndServe(listen string, tlsConfig *tls.Config)

Start a web server to listen for connections to tunnels, the left most part of the domain is the <username>--<tunnel name>

func Routes

func Routes(router *http.ServeMux)

func TunnelAgentPort added in v0.18.0

func TunnelAgentPort(agentSessionId string, port uint16, conn net.Conn)

Types

type TunnelClient added in v0.18.0

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

func NewTunnelClient added in v0.18.0

func NewTunnelClient(wsServerUrl, serverUrl, token string, skipTLSVerify bool, opts *TunnelOpts) *TunnelClient

func (*TunnelClient) ConnectAndServe added in v0.18.0

func (c *TunnelClient) ConnectAndServe() error

func (*TunnelClient) GetCtx added in v0.18.0

func (c *TunnelClient) GetCtx() context.Context

func (*TunnelClient) Shutdown added in v0.18.0

func (c *TunnelClient) Shutdown()

func (*TunnelClient) URL added in v0.29.0

func (c *TunnelClient) URL() string

URL returns the public tunnel URL for a web tunnel once ConnectAndServe has resolved it. It is empty for port tunnels or before ConnectAndServe runs.

type TunnelOpts added in v0.18.0

type TunnelOpts struct {
	Type          TunnelType // Type of tunnel
	Protocol      string     // http, https or tcp
	LocalPort     uint16     // The local port to forward to
	TunnelName    string     // The name of the tunnel for web tunnels
	SpaceName     string     // The name of the space for space tunnels
	SpacePort     uint16     // The port within the space being forwarded
	TlsName       string     // The name to present to TLS ports
	TlsSkipVerify bool       // Don't verify TLS of the local port
}

type TunnelType added in v0.18.0

type TunnelType int
const (
	WebTunnel TunnelType = iota
	PortTunnel
)

Jump to

Keyboard shortcuts

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