tunnel

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 24 Imported by: 9 modules, 20 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*cio.Logger
	Inbound   bool
	Outbound  bool
	Socks     bool
	KeepAlive time.Duration
	//ACL optionally checks if a given address (host:port) is allowed.
	//When set, outbound connections are denied if this returns false.
	ACL func(addr string) bool
}

Config a Tunnel

type Proxy

type Proxy struct {
	*cio.Logger
	// contains filtered or unexported fields
}

Proxy is the inbound portion of a Tunnel

func NewProxy

func NewProxy(logger *cio.Logger, sshTun sshTunnel, index int, remote *settings.Remote) (*Proxy, error)

NewProxy creates a Proxy

func (*Proxy) Close added in v1.12.0

func (p *Proxy) Close() error

Close unbinds the proxy's listeners. proxies which have been Run are instead closed by cancelling their context.

func (*Proxy) Run

func (p *Proxy) Run(ctx context.Context) error

Run enables the proxy and blocks while its active, close the proxy by cancelling the context.

type Tunnel

type Tunnel struct {
	Config
	// contains filtered or unexported fields
}

Tunnel represents an SSH tunnel with proxy capabilities. Both chisel client and server are Tunnels. chisel client has a single set of remotes, whereas chisel server has multiple sets of remotes (one set per client). Each remote has a 1:1 mapping to a proxy. Proxies listen, send data over ssh, and the other end of the ssh connection communicates with the endpoint and returns the response.

func New

func New(c Config) *Tunnel

New Tunnel from the given Config

func (*Tunnel) BindRemotes

func (t *Tunnel) BindRemotes(ctx context.Context, remotes []*settings.Remote) error

BindRemotes converts the given remotes into proxies, and blocks until the caller cancels the context or there is a proxy error.

func (*Tunnel) BindSSH

func (t *Tunnel) BindSSH(ctx context.Context, c ssh.Conn, reqs <-chan *ssh.Request, chans <-chan ssh.NewChannel) error

BindSSH provides an active SSH for use for tunnelling

func (*Tunnel) Ready added in v1.12.0

func (t *Tunnel) Ready(ctx context.Context) bool

Ready waits for an active ssh connection, returning false if none arrives before the context is cancelled or the connection wait times out

Jump to

Keyboard shortcuts

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