sshc

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_CONNECTING = "Connecting..."
	STATUS_CONNECTED  = "Connected"
	STATUS_CLOSED     = "Closed"
)

The ssh connection available statuses

Variables

This section is empty.

Functions

This section is empty.

Types

type JumpHostConf added in v0.6.3

type JumpHostConf struct {
	// user@server:port
	URI      string `yaml:"uri"`
	Identity string `yaml:"identity"`
}

JumpHostConf holds a jump host configuration

type SshClientConf added in v0.6.3

type SshClientConf struct {
	Identity   string `yaml:"identity"`
	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"`
	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

type SshConnection struct {
	Client *ssh.Client
	// used to inform the tunnels if this sshClient
	// is Connected. Tunnels will wait on this waitGroup to
	// know if the ssh client is Connected or not
	Connected sync.WaitGroup
	// contains filtered or unexported fields
}

SshConnection implements an ssh client

func NewSshConnection

func NewSshConnection(conf *SshClientConf) *SshConnection

NewSshConnection creates a new SshConnection instance

func (*SshConnection) Close

func (s *SshConnection) Close()

Close closes the ssh conn instance client connection

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) 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

Jump to

Keyboard shortcuts

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