portforward

package
v0.0.0-...-2b9c8bd Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0, MIT Imports: 18 Imported by: 1

Documentation

Overview

Package portforward holds the infrastructure to support the port forward command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileDescriptionConn

func NewFileDescriptionConn(file *vfs.FileDescription) proxyConn

NewFileDescriptionConn initializes a fileDescriptionConn.

func NewHostInetConn

func NewHostInetConn(port uint16) (proxyConn, error)

NewHostInetConn creates a hostInetConn backed by a host socket on the localhost address.

func NewNetstackConn

func NewNetstackConn(stack *stack.Stack, port uint16) (proxyConn, error)

NewNetstackConn creates a new port forwarding connection to the given port in netstack mode.

Types

type Proxy

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

Proxy controls copying data between two proxyConnections. Proxy takes ownership over the two connections and is responsible for cleaning up their resources (i.e. calling their Close method). Proxy(s) all run internal to the sandbox on the supervisor context.

func NewProxy

func NewProxy(pair ProxyPair, cid string) *Proxy

NewProxy returns a new Proxy.

func (*Proxy) AddCleanup

func (pf *Proxy) AddCleanup(cu func())

AddCleanup adds a cleanup to this Proxy's cleanup.

func (*Proxy) Close

func (pf *Proxy) Close()

Close cleans up the resources in this Proxy and blocks until all resources are cleaned up and their goroutines exit.

func (*Proxy) Start

func (pf *Proxy) Start(ctx context.Context)

Start starts the proxy. On error on either end, the proxy cleans itself up by stopping both connections.

type ProxyPair

type ProxyPair struct {
	To   proxyConn
	From proxyConn
}

ProxyPair wraps the to/from arguments for NewProxy so that the user explicitly labels to/from.

Jump to

Keyboard shortcuts

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