ssh

package module
Version: v0.0.0-...-d4c2fb2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	Username    string
	Password    string
	Address     string
	Port        int
	PrivateKey  string
	KeyFile     string
	AgentSocket string
	Timeout     time.Duration
	Bastion     string
	BastionPort int
	BastionUser string
}

type ClientSetting

type ClientSetting struct {
	Height, Width int
}

type ClientSettingFunc

type ClientSettingFunc func(*ClientSetting)

type Connection

type Connection interface {
	SSHClient(reader io.ReadWriter, opts ...ClientSettingFunc) error
	Exec(cmd string, host *HostCfg) (stdout string, err error)
	Scp(src, dst string) error
}

func NewConnection

func NewConnection(cfg Cfg) (Connection, error)

type Dialer

type Dialer struct {
	// contains filtered or unexported fields
}

func NewDialer

func NewDialer() *Dialer

func (*Dialer) Connect

func (dialer *Dialer) Connect(host HostCfg) (Connection, error)

type HostCfg

type HostCfg struct {
	Name            string `yaml:"name,omitempty" json:"name,omitempty"`
	Address         string `yaml:"address,omitempty" json:"address,omitempty"`
	InternalAddress string `yaml:"internalAddress,omitempty" json:"internalAddress,omitempty"`
	Port            string `yaml:"port,omitempty" json:"port,omitempty"`
	User            string `yaml:"user,omitempty" json:"user,omitempty"`
	Password        string `yaml:"password,omitempty" json:"password,omitempty"`
	PrivateKeyPath  string `yaml:"privateKeyPath,omitempty" json:"privateKeyPath,omitempty"`
	Arch            string `yaml:"arch,omitempty" json:"arch,omitempty"`
}

type Message

type Message struct {
	Op, Data   string
	Rows, Cols uint16
}

type ResizeEvent

type ResizeEvent interface {
	io.ReadWriter
	ResizeEvent(session *ssh.Session)
}

type TTYHandler

type TTYHandler struct {
	CloseCh chan struct{}
	// contains filtered or unexported fields
}

func NewTTYHandler

func NewTTYHandler(rw TTYReadWriter) *TTYHandler

func (TTYHandler) Close

func (t TTYHandler) Close()

func (TTYHandler) Read

func (t TTYHandler) Read(p []byte) (int, error)

func (TTYHandler) ResizeEvent

func (t TTYHandler) ResizeEvent(session *ssh.Session)

func (TTYHandler) Write

func (t TTYHandler) Write(p []byte) (int, error)

type TTYReadWriter

type TTYReadWriter interface {
	Read(m *Message) error
	Writer(m *Message) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL