ssh

package module
v0.0.0-...-0e11468 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: Apache-2.0 Imports: 12 Imported by: 6

README

ssh

go libs ssh

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dsts []io.Writer, src io.Reader) (int64, error)

Copy copy buffer

Types

type Endpoint

type Endpoint struct {
	Name      string            `yaml:"name"`
	Host      string            `yaml:"host"`
	IP        string            `yaml:"ip"`
	Port      string            `yaml:"port"`
	User      string            `yaml:"user"`
	Users     []string          `yaml:"users"` // 多个用户
	Password  string            `yaml:"password"`
	Passwords []string          `yaml:"passwords"` //密码列表
	Key       string            `yaml:"key"`
	QAs       map[string]string `yaml:"qas"`    //questions-answers
	Pseudo    bool              `yaml:"pseudo"` // like "ssh -tt", Force pseudo-terminal allocation.
	Timeout   int               `yaml:"timeout"`
	Labels    map[string]string `yaml:"labels"`
	// contains filtered or unexported fields
}

Endpoint Endpoint !! users, passwords 仅在登陆认证时当user/password字段为空时使用

func NewEndpoint

func NewEndpoint(s ...string) *Endpoint

NewEndpoint NewEndpoint

func NewEndpointWithValue

func NewEndpointWithValue(name, host, ip, port, user, password, key string, writers ...io.Writer) *Endpoint

NewEndpointWithValue NewEndpointWithValue

func (*Endpoint) Address

func (ep *Endpoint) Address() string

Address Address

func (*Endpoint) Close

func (ep *Endpoint) Close() error

Close close endpoint client

func (*Endpoint) CmdOutBytes

func (ep *Endpoint) CmdOutBytes(cmd string) ([]byte, error)

CmdOutBytes CmdOutBytes

func (*Endpoint) Copy

func (ep *Endpoint) Copy() *Endpoint

Copy copy a endpoint

func (*Endpoint) Download

func (ep *Endpoint) Download(src, dest string) error

Download Download

func (*Endpoint) Find

func (ep *Endpoint) Find(querys ...string) bool

Find means when all querys must in Endpoint, then return true

func (*Endpoint) FindOr

func (ep *Endpoint) FindOr(querys ...string) bool

FindOr querys in endpoint

func (*Endpoint) GetPasswords

func (ep *Endpoint) GetPasswords() ([]string, bool)

GetPasswords get passwords list if password is not null, then return password directly

func (*Endpoint) GetUsers

func (ep *Endpoint) GetUsers() ([]string, bool)

GetUsers get users list if user is not null, then return user directly

func (*Endpoint) Init

func (ep *Endpoint) Init(filename string) error

Init Init

func (*Endpoint) InitSSHClient

func (ep *Endpoint) InitSSHClient() (err error)

InitSSHClient InitSSHClient

func (*Endpoint) Mask

func (ep *Endpoint) Mask(endpoints ...*Endpoint)

Mask endpoint, 优先级从高到底, 如果之前的有值那么后面的默认忽略掉

func (*Endpoint) SetPasswords

func (ep *Endpoint) SetPasswords(passwords ...string)

SetPasswords set multi-password

func (*Endpoint) SetPseudo

func (ep *Endpoint) SetPseudo(pseudo bool)

SetPseudo disable/force pseudo-terminal allocation.

func (*Endpoint) SetTimeout

func (ep *Endpoint) SetTimeout(timeout int)

SetTimeout SetTimeout

func (*Endpoint) SetUsers

func (ep *Endpoint) SetUsers(users ...string)

SetUsers set multi-user

func (*Endpoint) SetWriters

func (ep *Endpoint) SetWriters(writers ...io.Writer)

SetWriters this method is useful in StartTerminal

func (*Endpoint) StartTerminal

func (ep *Endpoint) StartTerminal() error

StartTerminal StartTerminal

func (*Endpoint) Upload

func (ep *Endpoint) Upload(src, dest string, mode os.FileMode) error

Upload Upload

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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