ssh

package
v0.5.2-beta Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSHClientEventDialing = iota
	SSHClientEventConnected
	SSHClientEventMasterClosed
	SSHClientEventClosed
	SSHClientEventError
)

Variables

View Source
var NewSSHClient = func() *SSHClient {
	c := &SSHClient{}
	c.Events = make(chan *SSHClientEvent, 10)
	c.Env = make(map[string]string)
	return c
}

Functions

func GetSSHAgentClient

func GetSSHAgentClient() (agent.ExtendedAgent, error)

func GetSSHClientConfig

func GetSSHClientConfig(cc *ClientConfigParameters) (*ssh.ClientConfig, error)

Types

type ClientConfigParameters

type ClientConfigParameters struct {
	Target *string `json:"target" validate:"required"`
	Port   uint16  `json:"port"`
	//
	Username             *string `json:"username" validate:"required"`
	PrivateKey           *string `json:"privkey"`
	PrivateKeyPath       *string `json:"privkeyPath"`
	PrivateKeyPassphrase *string `json:"passphrase"`
	Password             *string `json:"password"`
	//
	Proxies []*ClientConfigParameters `json:"proxies"`
}

type SSHClient

type SSHClient struct {
	DialAddr string

	// will be shared between clients
	Events chan *SSHClientEvent
	Env    map[string]string
	// contains filtered or unexported fields
}

sshClient obj

func (*SSHClient) Connect

func (s *SSHClient) Connect(addr string, config *ssh.ClientConfig) error

Connect func

func (*SSHClient) Dial

func (s *SSHClient) Dial(addr string, config *ssh.ClientConfig) (*SSHClient, error)

func (*SSHClient) DialWithProxies

func (s *SSHClient) DialWithProxies(ccp *ClientConfigParameters) (*SSHClient, error)

func (*SSHClient) Disconnect

func (s *SSHClient) Disconnect() error

Disconnect func

func (*SSHClient) GetConn

func (s *SSHClient) GetConn() *ssh.Client

func (*SSHClient) Listen

func (s *SSHClient) Listen(network string, address string) (net.Listener, error)

func (*SSHClient) NewSCPClientFromExistingSSH

func (s *SSHClient) NewSCPClientFromExistingSSH() (*scp.Client, error)

func (*SSHClient) NewSession

func (s *SSHClient) NewSession() (*ssh.Session, error)

func (*SSHClient) NewSessionShellWithOpts

func (s *SSHClient) NewSessionShellWithOpts(opts *SessOpts) (*ssh.Session, error)

func (*SSHClient) StartIPC

func (s *SSHClient) StartIPC() (*ipc.IPCConsumer, error)

type SSHClientEvent

type SSHClientEvent struct {
	Type      SSHClientEventType
	Error     error
	SSHClient *SSHClient
}

type SSHClientEventType

type SSHClientEventType int

type SessOpts

type SessOpts struct {
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	WithPTY bool
}

Jump to

Keyboard shortcuts

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