Documentation ¶
Overview ¶
Package sshtunnel lets you dial (and re-publish locally) SSH-tunneled TCP. and Unix domain socket connections using the native Go SSH client golang.org/x/crypto/ssh.
Index ¶
- func Dial(network, addr string, config *Config) (net.Conn, <-chan error, error)
- func DialContext(ctx context.Context, network, addr string, config *Config) (net.Conn, <-chan error, error)
- func Listen(laddr net.Addr, network, addr string, config *Config, ...) (net.Listener, chan error, error)
- func ListenContext(ctx context.Context, laddr net.Addr, network, addr string, config *Config, ...) (net.Listener, chan error, error)
- func ReDial(network, addr string, config *Config, backoffConfig backoff.Config) (<-chan net.Conn, <-chan error)
- func ReDialContext(ctx context.Context, network, addr string, config *Config, ...) (<-chan net.Conn, <-chan error)
- type Config
- type ConfigAuth
- type ConfigSSHAgent
- type DialFunc
- type KeySource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial opens a tunnelled connection to the address on the named network. Supported networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "unix", "unixgram" and "unixpacket".
func DialContext ¶
func DialContext(ctx context.Context, network, addr string, config *Config) (net.Conn, <-chan error, error)
DialContext opens a tunnelled connection to the address on the named network using the provided context.
See func Dial for a description of the network and address parameters.
func Listen ¶
func Listen(laddr net.Addr, network, addr string, config *Config, reconnectBackoff backoff.Config) (net.Listener, chan error, error)
Listen is ListenContext with context.Background()
func ListenContext ¶
func ListenContext(ctx context.Context, laddr net.Addr, network, addr string, config *Config, reconnectBackoff backoff.Config) (net.Listener, chan error, error)
ListenContext serves an SSH tunnel to a remote address on the given local network address `laddr`. The remote endpoint of the tunneled connections is given by the network and addr parameters.
See func ReDial for a description of the network, addr, config and reconnectBackoff parameters.
func ReDial ¶
func ReDial(network, addr string, config *Config, backoffConfig backoff.Config) (<-chan net.Conn, <-chan error)
ReDial opens a tunnelled connection to the address on the named network.
Failed connections are re-dialled following the given back-off configuration. Dropped connections are immediately re-dialed.
Supported networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "unix", "unixgram" and "unixpacket".
func ReDialContext ¶
func ReDialContext(ctx context.Context, network, addr string, config *Config, backoffConfig backoff.Config) (<-chan net.Conn, <-chan error)
ReDialContext opens a tunnelled connection to the address on the named network using the provided context.
Failed connections are re-dialled following the given back-off configuration. Dropped connections are immediately re-dialed.
See func ReDial for a description of the network and address parameters.
Types ¶
type Config ¶
type Config struct { // SSHAddr is the host:port address of the SSH server (required). SSHAddr string // SSHClient is the ssh.Client config (required). SSHClient *ssh.ClientConfig // SSHConn is a pre-existing connection to an SSH server (optional). SSHConn net.Conn }
Config is an SSH tunnel configuration.
When `SSHConn` is set to a non-nil net.Conn, that connection is reused instead of opening a new one.
type ConfigAuth ¶
type ConfigAuth struct { Password *string SSHAgent *ConfigSSHAgent Keys []KeySource }
ConfigAuth is an authentication configuration for an SSH tunnel.
func (ConfigAuth) Methods ¶
func (a ConfigAuth) Methods() (out []ssh.AuthMethod, err error)
Methods returns the configured SSH auth methods.
type ConfigSSHAgent ¶
ConfigSSHAgent is the configuration for an ssh-agent connection.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package sshtunnel lets you dial (and re-publish locally) SSH-tunneled TCP and Unix domain socket connections using external SSH client processes.
|
Package sshtunnel lets you dial (and re-publish locally) SSH-tunneled TCP and Unix domain socket connections using external SSH client processes. |