Documentation
¶
Index ¶
- Variables
- func CoverDefaults(node interface{}, defaults interface{}, override bool)
- func TeeReader(r io.Reader, wList ...io.Writer) io.Reader
- type BufferedReader
- type Config
- type Node
- type SSHClient
- func (c *SSHClient) CurrentClient() *ssh.Client
- func (c *SSHClient) CurrentSession() *ssh.Session
- func (c *SSHClient) Login(user, password string) (err error)
- func (c *SSHClient) LoginAuth(user string, authMethods []ssh.AuthMethod) (err error)
- func (c *SSHClient) RequestTerminal() (fd int, state *term.State, err error)
- func (c *SSHClient) RestoreTerminal(fd int, state *term.State) error
- func (c *SSHClient) Run(cmd string) (output string, err error)
- func (c *SSHClient) Shell() error
- func (c *SSHClient) Start(cmd string) error
- func (c *SSHClient) Wait() error
- type Settings
- type WriteCloser
Constants ¶
This section is empty.
Variables ¶
var ( Ciphers = []string{ "aes128-ctr", "aes192-ctr", "aes256-ctr", "[email protected]", "[email protected]", "arcfour256", "arcfour128", "arcfour", "aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", } KeyExchanges = []string{ "diffie-hellman-group-exchange-sha256", "diffie-hellman-group18-sha512", "diffie-hellman-group16-sha512", "diffie-hellman-group14-sha256", } Outputs = []io.Writer{os.Stdout} )
Functions ¶
func CoverDefaults ¶
func CoverDefaults(node interface{}, defaults interface{}, override bool)
CoverDefaults assigns default values to zero-valued fields in node if override is set to false. It overrides node values for all non-zero fields in defaults if override is set to true. The two arguments should be of the same type.
Types ¶
type BufferedReader ¶
func NewBufferedReader ¶
func NewBufferedReader(r io.Reader, wList ...io.Writer) *BufferedReader
NewBufferedReader returns a BufferedReader that writes to wList what it reads from r.
func (BufferedReader) ReadUntil ¶
func (br BufferedReader) ReadUntil(pattern string) (result []byte, err error)
ReadUntil reads from r one byte at a time until the bytes read match the given pattern
func (BufferedReader) ReadUntilEOF ¶
func (br BufferedReader) ReadUntilEOF() (result []byte)
ReadUntilEOF reads from r one byte at a time until io.EOF
type Config ¶
type Config struct { Settings *Settings `yaml:"settings"` Defaults *Node `yaml:"default"` Nodes []*Node `yaml:"nodes"` }
func LoadConfig ¶
type Node ¶
type Node struct { Name string `yaml:"name"` Alias string `yaml:"alias"` Host string `yaml:"host"` Port int `yaml:"port"` User string `yaml:"user"` Password string `yaml:"password"` KeyPath string `yaml:"keypath"` Passphrase string `yaml:"passphrase"` }
func GetNode ¶
func GetNode(config *Config, target string, chosen *Node, defaultsOnly bool, overrider *Node) (node *Node)
Get node from target, or choose from menu, and then override fields with overrider. chosen will be ignored if target is not empty. If defaultsOnly is set to true, empty values will only be covered with defaults, logins section will not be used. Values in overrider have top priority.
func (*Node) AuthMethods ¶
func (n *Node) AuthMethods() (authMethods []ssh.AuthMethod)
func (*Node) SetDefaults ¶
SetDefaults sets sensible values for unset fields in node
type SSHClient ¶
type SSHClient struct { Host string Port int *BufferedReader *WriteCloser // contains filtered or unexported fields }
func (*SSHClient) CurrentClient ¶
func (*SSHClient) CurrentSession ¶
func (*SSHClient) LoginAuth ¶
func (c *SSHClient) LoginAuth(user string, authMethods []ssh.AuthMethod) (err error)
Login to remote server with multiple auth methods
func (*SSHClient) RequestTerminal ¶
func (*SSHClient) RestoreTerminal ¶
type WriteCloser ¶
type WriteCloser struct {
io.WriteCloser
}
func (*WriteCloser) WriteString ¶
func (w *WriteCloser) WriteString(s string) (n int, err error)