Documentation
¶
Index ¶
- type ConnState
- type Endpoint
- type ForwardConfig
- func (tun *ForwardConfig) CleanTargetSocketFile() error
- func (tun *ForwardConfig) GetAliveConnCount() int
- func (tun *ForwardConfig) SetConnState(connStateFun func(*ForwardConfig, ConnState))
- func (tun *ForwardConfig) SetKeyFile(file string) *ForwardConfig
- func (tun *ForwardConfig) SetPort(port int) *ForwardConfig
- func (tun *ForwardConfig) SetTunneledConnState(tunneledConnStateFun func(*ForwardConfig, *TunneledConnState))
- func (tun *ForwardConfig) SetUser(user string) *ForwardConfig
- func (tun *ForwardConfig) Start(ctx context.Context) error
- func (tun *ForwardConfig) Stop()
- type ForwardType
- type TunneledConnState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnState ¶
type ConnState int
const ( // StateStopped represents a stopped tunnel. A call to Start will make the state to transition to StateStarting. StateStopped ConnState = iota // StateStarting represents a tunnel initializing and preparing to listen for connections. // A successful initialization will make the state to transition to StateStarted, otherwise it will transition to StateStopped. StateStarting // StateStarted represents a tunnel ready to accept connections. // A call to stop or an error will make the state to transition to StateStopped. StateStarted )
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func NewServerEndpoint ¶
func NewUnixEndpoint ¶
type ForwardConfig ¶
type ForwardConfig struct { User string Server *Endpoint Local *Endpoint Remote *Endpoint SSHClient *ssh.Client SSHConfig *ssh.ClientConfig // contains filtered or unexported fields }
func NewUnix ¶
func NewUnix(localUnixSocket string, server string, remoteUnixSocket string) *ForwardConfig
NewUnix does the same as New but using unix sockets.
func NewUnixRemote ¶
func NewUnixRemote(localUnixSocket string, server string, remoteUnixSocket string) *ForwardConfig
NewUnixRemote does the same as NewRemote but using unix sockets.
func (*ForwardConfig) CleanTargetSocketFile ¶
func (tun *ForwardConfig) CleanTargetSocketFile() error
CleanTargetSocketFile delete the target socket file before forward
func (*ForwardConfig) GetAliveConnCount ¶
func (tun *ForwardConfig) GetAliveConnCount() int
func (*ForwardConfig) SetConnState ¶
func (tun *ForwardConfig) SetConnState(connStateFun func(*ForwardConfig, ConnState))
SetConnState specifies an optional callback function that is called when a SSH tunnel changes state. See the ConnState type and associated constants for details.
func (*ForwardConfig) SetKeyFile ¶
func (tun *ForwardConfig) SetKeyFile(file string) *ForwardConfig
SetKeyFile changes the authentication to key-based and uses the specified file. Leaving the file empty defaults to the default linux private key locations: `~/.ssh/id_rsa`, `~/.ssh/id_dsa`, `~/.ssh/id_ecdsa`, `~/.ssh/id_ecdsa_sk`, `~/.ssh/id_ed25519` and `~/.ssh/id_ed25519_sk`.
func (*ForwardConfig) SetPort ¶
func (tun *ForwardConfig) SetPort(port int) *ForwardConfig
SetPort changes the port where the SSH connection will be made.
func (*ForwardConfig) SetTunneledConnState ¶
func (tun *ForwardConfig) SetTunneledConnState(tunneledConnStateFun func(*ForwardConfig, *TunneledConnState))
func (*ForwardConfig) SetUser ¶
func (tun *ForwardConfig) SetUser(user string) *ForwardConfig
SetUser changes the user used to make the SSH connection.
func (*ForwardConfig) Stop ¶
func (tun *ForwardConfig) Stop()
Stop closes all connections and makes Start exit `gracefully`.
type TunneledConnState ¶
type TunneledConnState struct { // From is the address initating the connection. From string // Info holds a message with info on the state of the connection (useful for debug purposes). Info string // Error holds an error on the connection or nil if the connection is successful. Error error // Ready indicates if the connection is established. Ready bool // Closed indicates if the connection is closed. Closed bool }
func (*TunneledConnState) String ¶
func (s *TunneledConnState) String() string