ssh

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

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ssh

AFAIRE


Copyright (c) 2022-2023 Archivage Numérique

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MD5

func MD5(output string, err error) (string, error)

func ToString

func ToString(output []byte, err error) (string, error)

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        `dm:"host"`
	Port           int           `dm:"port"`
	Username       string        `dm:"username"`
	Password       string        `dm:"password"`
	KeyFile        string        `dm:"key_file"`
	Passphrase     string        `dm:"passphrase"`
	ConnectTimeout time.Duration `dm:"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) CatFile

func (conn *Connection) CatFile(pathFile string) ([]byte, error)

func (*Connection) Close

func (conn *Connection) Close() error

func (*Connection) Execute

func (conn *Connection) Execute(cmd string) ([]byte, error)

func (*Connection) Host

func (conn *Connection) Host() string

func (*Connection) MD5SumFile

func (conn *Connection) MD5SumFile(pathFile string) (string, error)

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(string) (string, error)
}

type Logger

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

type Session

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

func (*Session) Close

func (s *Session) Close() error

func (*Session) Execute

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

func (*Session) Run

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

func (*Session) Start

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

func (*Session) Wait

func (s *Session) Wait() 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
⌂ 换网址