myssh

package
v0.0.0-...-efaec8f Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_TIMEOUT = 3 * time.Minute

Variables

View Source
var (
	ErrNotValid = errors.New("SSHClient not valid")
)

Functions

This section is empty.

Types

type SSHClient

type SSHClient struct {
	Addr    string
	User    string
	KeyFile string
	// contains filtered or unexported fields
}

func NewSSHClient

func NewSSHClient(remoteURL string, remoteKey string) (cli *SSHClient, err error)

func (*SSHClient) Close

func (cli *SSHClient) Close()

func (*SSHClient) Dial

func (cli *SSHClient) Dial(n string, addr string) (c net.Conn, err error)

func (*SSHClient) IsValid

func (cli *SSHClient) IsValid() bool

func (*SSHClient) Ping

func (cli *SSHClient) Ping() (err error)

func (*SSHClient) Shutdown

func (cli *SSHClient) Shutdown()

type SSHClientPool

type SSHClientPool struct {
	URL      string
	Key      string
	MaxConns int
	// contains filtered or unexported fields
}

ssh 连接池

func NewSSHClientPool

func NewSSHClientPool(url, key string, maxConns int) (pool *SSHClientPool, err error)

func (*SSHClientPool) Dial

func (pool *SSHClientPool) Dial(n, addr string) (c net.Conn, err error)

func (*SSHClientPool) Shutdown

func (pool *SSHClientPool) Shutdown()

type SSHConn

type SSHConn struct {
	net.Conn
	IsLocal bool
}

func (*SSHConn) Close

func (c *SSHConn) Close() error

func (*SSHConn) Read

func (c *SSHConn) Read(b []byte) (n int, err error)

func (*SSHConn) Write

func (c *SSHConn) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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