Documentation
¶
Index ¶
Constants ¶
const ( STATUS_CONNECTING = "Connecting..." STATUS_CONNECTED = "Connected" STATUS_CLOSED = "Closed" )
The ssh connection available statuses
const DEFAULT_DNS_SERVER = "1.1.1.1:53"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DnsProxy ¶ added in v0.9.2
type DnsProxy struct {
// contains filtered or unexported fields
}
func NewDnsProxy ¶ added in v0.9.2
func NewDnsProxy(sshConn *SshConnection, conf *DnsProxyConf) *DnsProxy
type DnsProxyConf ¶ added in v0.9.2
type DnsProxyConf struct {
ListenAddress string `yaml:"listen_address"`
RemoteDnsAddress *string `yaml:"remote_dns_address"`
// use a dedicated ssh client. if nil use the global one
SshClientConf *SshClientConf `yaml:"sshclient"`
}
type JumpHostConf ¶ added in v0.6.3
type JumpHostConf struct {
// user@server:port
URI string `yaml:"uri"`
Identity string `yaml:"identity"`
Password string `yaml:"password"`
}
JumpHostConf holds a jump host configuration
type ProgressFunc ¶ added in v0.9.2
type RemoteShell ¶ added in v0.7.0
type RemoteShell struct {
// contains filtered or unexported fields
}
RemoteShell handles remote shell connections. It uses an ssh connection object and requests a shell inside a pty to the remote server
func NewRemoteShell ¶ added in v0.7.0
func NewRemoteShell(sshConn *SshConnection) *RemoteShell
NewRemoteShell creates a new RemoteShell object
func (*RemoteShell) Start ¶ added in v0.7.0
func (rs *RemoteShell) Start(cmd string, requestPty bool) error
Start starts the remote shell
func (*RemoteShell) Stop ¶ added in v0.7.0
func (rs *RemoteShell) Stop()
Stop stops the remote shell
type SftpClient ¶ added in v0.9.2
func NewSftpClient ¶ added in v0.9.2
func NewSftpClient(sshConnection *SshConnection) *SftpClient
func (*SftpClient) GetFile ¶ added in v0.9.2
func (s *SftpClient) GetFile(remote, localPath string, maxWorkers int, progressFn *ProgressFunc) error
func (*SftpClient) PutFile ¶ added in v0.9.2
func (s *SftpClient) PutFile(remote, localPath string, maxWorkers int, progressFn *ProgressFunc) error
func (*SftpClient) ReadyWait ¶ added in v0.9.2
func (s *SftpClient) ReadyWait()
Waits until the connection is estabilished with the server
func (*SftpClient) Start ¶ added in v0.9.2
func (s *SftpClient) Start()
func (*SftpClient) Stop ¶ added in v0.9.2
func (s *SftpClient) Stop()
type SocksProxy ¶ added in v0.9.2
type SocksProxy struct {
// contains filtered or unexported fields
}
func NewSocksProxy ¶ added in v0.9.2
func NewSocksProxy(sshConn *SshConnection) *SocksProxy
func (*SocksProxy) Start ¶ added in v0.9.2
func (p *SocksProxy) Start(socksAddress string) error
Start starts the local socks proxy
type SocksProxyConf ¶ added in v0.9.2
type SocksProxyConf struct {
ListenAddress string `yaml:"listen_address"`
// use a dedicated ssh client. if nil use the global one
SshClientConf *SshClientConf `yaml:"sshclient"`
}
type SshClientConf ¶ added in v0.6.3
type SshClientConf struct {
Identity string `yaml:"identity"`
Password string `yaml:"password"`
KnownHosts string `yaml:"known_hosts"`
ServerURI string `yaml:"server"`
// it this value is true host keys are not checked
// against known_hosts file
Insecure bool `yaml:"insecure"`
Quiet bool `yaml:"quiet"`
JumpHosts []*JumpHostConf `yaml:"jump_hosts"`
}
SshClientConf holds the ssh client configuration
func (*SshClientConf) GetServerEndpoint ¶ added in v0.6.3
func (c *SshClientConf) GetServerEndpoint() *utils.Endpoint
GetServerEndpoint Builds a server endpoint object from the Server string
type SshConnection ¶
SshConnection implements an ssh client
func NewSshConnection ¶
func NewSshConnection(conf *SshClientConf) *SshConnection
NewSshConnection creates a new SshConnection instance
func (*SshConnection) GetConnectionStatus ¶ added in v0.6.3
func (s *SshConnection) GetConnectionStatus() string
GetConnectionStatus returns the current connection status as a string
func (*SshConnection) GrabPubKey ¶ added in v0.6.3
func (s *SshConnection) GrabPubKey()
GrabPubKey is an helper function that gets server pubkey
func (*SshConnection) ReadyWait ¶ added in v0.9.2
func (s *SshConnection) ReadyWait()
Waits until the connection is estabilished with the server
func (*SshConnection) Start ¶
func (s *SshConnection) Start()
Start connects the ssh client to the remote server and keeps it connected sending keep alive packet and reconnecting in the event of network failures
func (*SshConnection) Stop ¶ added in v0.7.0
func (s *SshConnection) Stop()
Stop closes the ssh conn instance client connection