ssh

package
v0.0.0-...-4d456dd Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(cfg *Config, data []byte)

Types

type Config

type Config []HostConfig

ssh config文件

func Read

func Read(file *os.File) *Config

func Scan

func Scan(r io.Reader) *Config

func (*Config) GetHost

func (c *Config) GetHost(host string) HostConfig

func (*Config) Marshal

func (c *Config) Marshal() []byte

func (*Config) RemoveHost

func (c *Config) RemoveHost(host string)

func (*Config) SetHost

func (c *Config) SetHost(host HostConfig)

type HostConfig

type HostConfig struct {
	Host                  string
	ServerAliveInterval   int
	HostName              string
	User                  string
	Port                  int
	StrictHostKeyChecking string
	UserKnownHostsFile    string
	IdentityFile          string
	LogLevel              string
}

func (*HostConfig) Map

func (hc *HostConfig) Map(lambda func(key string, value interface{}))

type SSH

type SSH struct {
	Host       string `json:"host"`
	Username   string `json:"username"`
	Port       int    `json:"port"`
	Password   string `json:"password"`
	PrivateKey string `json:"private_key"`
	Stdout     io.Writer
	Stderr     io.Writer
	Stdin      io.Reader
}

func (*SSH) NewClient

func (s *SSH) NewClient() (*ssh.Client, error)

func (*SSH) WriteBytesToRemoteHost

func (s *SSH) WriteBytesToRemoteHost(data []byte, filename string) error

Jump to

Keyboard shortcuts

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