tunneler

package
v2.33.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	DialAgent(dialCtx context.Context, agentID uuid.UUID, options *workspacesdk.DialAgentOptions) (workspacesdk.AgentConn, error)
}

type Config

type Config struct {
	// Required
	WorkspaceID      uuid.UUID
	App              NetworkedApplication
	WorkspaceStarter WorkspaceStarter

	// AgentName is the name of the agent to tunnel to. If blank, assumes workspace has only one agent and will cause
	// an error if that is not the case.
	AgentName string
	// NoAutostart can be set to true to prevent the tunneler from automatically starting the workspace.
	NoAutostart bool
	// NoWaitForScripts can be set to true to cause the tunneler to dial as soon as the agent is up, not waiting for
	// nominally blocking startup scripts.
	NoWaitForScripts bool
	// LogWriter is used to write progress logs (build, scripts, etc) if non-nil.
	LogWriter io.Writer
	// DebugLogger is used for logging internal messages and errors for debugging (e.g. in tests)
	DebugLogger slog.Logger
}

type NetworkedApplication

type NetworkedApplication interface {
	// Closer is used to gracefully tear down the application prior to stopping the tunnel.
	io.Closer
	// Start the NetworkedApplication, using the provided AgentConn to connect.
	Start(conn workspacesdk.AgentConn) error
}

NetworkedApplication is the application that runs on top of the tailnet tunnel.

type Tunneler

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

func NewTunneler

func NewTunneler(client Client, config Config) *Tunneler

type WorkspaceStarter

type WorkspaceStarter interface {
	StartWorkspace() error
}

WorkspaceStarter is used to create a start build of the workspace. It is an interface here because the CLI has lots of complex logic for determining the build parameters including prompting and environment variables, which we don't want to burden the Tunneler with. Other users of the Tunneler like `scaletest` can have a much simpler implementation.

Jump to

Keyboard shortcuts

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