ssh

package module
v0.0.0-...-c3ad93c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 9 Imported by: 0

README

ssh

AFAIRE

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) Connect

func (c *Client) Connect(logger Logger) (*Connection, error)

type Clients

type Clients map[string]map[string]*Client

func NewClients

func NewClients(config []*Config, crypto Crypto) (Clients, error)

func (Clients) Connect

func (cs Clients) Connect(host, username string, logger Logger) (*Connection, error)

type Config

type Config struct {
	Host           string        `cfg:"host"`
	Port           int           `cfg:"port"`
	Username       string        `cfg:"username"`
	Password       string        `cfg:"password"`
	KeyFile        string        `cfg:"key_file"`
	Passphrase     string        `cfg:"passphrase"`
	ConnectTimeout time.Duration `cfg:"connect_timeout"`
}

func (*Config) Decrypt

func (c *Config) Decrypt(crypto Crypto) error

func (*Config) NewClient

func (c *Config) NewClient() (*Client, error)

type Connection

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

func (*Connection) Disconnect

func (conn *Connection) Disconnect()

func (*Connection) Host

func (conn *Connection) Host() string

func (*Connection) NewSession

func (conn *Connection) NewSession() (*Session, error)

func (*Connection) Port

func (conn *Connection) Port() int

func (*Connection) ReadStream

func (conn *Connection) ReadStream(ctx context.Context, cmd string) (*Stream, error)

func (*Connection) Run

func (conn *Connection) Run(cmd string) error

func (*Connection) Username

func (conn *Connection) Username() string

type Crypto

type Crypto interface {
	DecryptString(text string) (string, error)
}

type Logger

type Logger interface {
	zombie.Logger
	Debug(msg string, kv ...interface{})
	Notice(msg string, kv ...interface{})
	Error(msg string, kv ...interface{})
}

type Session

type Session struct {
	*ssh.Session
	// contains filtered or unexported fields
}

func (*Session) CombinedOutput

func (s *Session) CombinedOutput(cmd string) ([]byte, error)

func (*Session) Output

func (s *Session) Output(cmd string) ([]byte, error)

func (*Session) Run

func (s *Session) Run(cmd string) error

func (*Session) Start

func (s *Session) Start(cmd string) error

type Stream

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

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) Done

func (s *Stream) Done() <-chan error

func (*Stream) Stderr

func (s *Stream) Stderr() <-chan string

func (*Stream) Stdout

func (s *Stream) Stdout() <-chan string

func (*Stream) Stop

func (s *Stream) Stop()

Jump to

Keyboard shortcuts

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