tunnel

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package tunnel provides the functions used by the CLI to tunnel into a container using either a tunneled connection from the workspace client (using a machine provider) or a direct SSH connection from the proxy client (Ssh, k8s or docker provider)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTunnel added in v0.2.0

func NewTunnel(ctx context.Context, tunnel Tunnel, handler Handler) error

NewTunnel creates a tunnel to the devcontainer using generic functions to establish the "outer" and "inner" tunnel, used by proxy clients Here the tunnel will be an SSH connection with it's STDIO as arguments and the handler will be the function to execute the command using the connected SSH client.

func RunServices added in v0.6.8

func RunServices(
	ctx context.Context,
	devPodConfig *config.Config,
	containerClient *ssh.Client,
	user string,
	forwardPorts bool,
	extraPorts []string,
	gitUsername,
	gitToken string,
	workspace *provider.Workspace,
	log log.Logger,
) error

RunServices forwards the ports for a given workspace and uses it's SSH client to run the credentials server remotely and the services server locally to communicate with the container

Types

type ContainerTunnel added in v0.6.8

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

ContainerTunnel manages the state of the tunnel to the container

func NewContainerTunnel

func NewContainerTunnel(client client.WorkspaceClient, proxy bool, log log.Logger) *ContainerTunnel

NewContainerTunnel constructs a ContainerTunnel using the workspace client, if proxy is True then the workspace's agent config is not periodically updated

func (*ContainerTunnel) Run added in v0.6.8

func (c *ContainerTunnel) Run(ctx context.Context, handler Handler, cfg *config.Config, envVars map[string]string) error

Run creates an "outer" tunnel to the host to start the SSH server so that the "inner" tunnel can connect to the container over SSH

type Handler

type Handler func(ctx context.Context, containerClient *ssh.Client) error

Handler defines what to do once the tunnel has a client established

type Tunnel added in v0.2.0

type Tunnel func(ctx context.Context, stdin io.Reader, stdout io.Writer) error

Tunnel defines the function to create an "outer" tunnel

Jump to

Keyboard shortcuts

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