Documentation
¶
Index ¶
- type Config
- type Meta
- type Proxy
- type Tap
- type TapFactory
- type Tunnel
- func (t *Tunnel) BindRemotes(ctx context.Context, remotes []*settings.Remote) error
- func (t *Tunnel) BindSSH(ctx context.Context, c ssh.Conn, reqs <-chan *ssh.Request, ...) error
- func (t *Tunnel) DeliverToRemote(ctx context.Context, r *settings.Remote, payload []byte) error
- func (t *Tunnel) DeliverToRemoteWithResponse(ctx context.Context, r *settings.Remote, payload []byte) ([]byte, error)
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
TlsConf *tls.Config
IsClient bool
// Optional tap factory for per-connection capture
TapFactory TapFactory
// Username owning this tunnel (for tagging)
Username string
}
Config a Tunnel
type Proxy ¶
Proxy is the inbound portion of a Tunnel
type Tap ¶
type Tap interface {
OnOpen()
SrcWriter() io.Writer // bytes flowing from src->dst (client -> upstream)
DstWriter() io.Writer // bytes flowing from dst->src (upstream -> client)
OnClose(sent int64, received int64)
}
Tap receives lifecycle and byte-stream callbacks for a single connection.
type TapFactory ¶
TapFactory creates a Tap for a given connection meta. It can return nil to disable capture for that connection.
type Tunnel ¶
type Tunnel struct {
Config
//internals
TlsConf *tls.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 (*Tunnel) BindRemotes ¶
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) DeliverToRemote ¶
DeliverToRemote opens an SSH channel to the given remote and writes the payload bytes, then closes.
func (*Tunnel) DeliverToRemoteWithResponse ¶
func (t *Tunnel) DeliverToRemoteWithResponse(ctx context.Context, r *settings.Remote, payload []byte) ([]byte, error)
DeliverToRemoteWithResponse opens an SSH channel to the given remote, writes the payload, half-closes the write side, then reads all response bytes until EOF or context timeout.