Documentation
¶
Overview ¶
Package sshconfig reads OpenSSH client configuration (~/.ssh/config) for import and for the keys a host offers: the Host blocks, with the directives SSHYard keeps (HostName, User, Port, IdentityFile, IdentitiesOnly, ProxyJump), Include, and the defaults of pattern blocks such as Host *. It only reads files; it never writes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Entries are the config's hosts in order, patterns included (marked),
// Host * left out.
Entries []Entry
// Errors are the lines that could not be read, as "file:line: why";
// they do not stop the parse.
Errors []string
// contains filtered or unexported fields
}
Config is a parsed config.
type Entry ¶
type Entry struct {
// Alias is the name on the Host line.
Alias string
// HostName is where to connect, the alias when the config names none.
HostName string
User string
Port int // 0: not given (22)
// IdentityFiles are the key files, expanded to absolute paths, in order.
IdentityFiles []string
// IdentitiesOnly offers only the IdentityFiles, not the agent's other
// keys.
IdentitiesOnly bool
// ProxyJump is the jump chain, first hop first; nil for none.
ProxyJump []Hop
// Unsupported names the directives applying to the host that are not
// imported, as ProxyCommand or LocalForward, each once.
Unsupported []string
// Pattern reports a Host of wildcards (*.corp): it names no one host and
// is skipped. Host * itself gives defaults and is no entry.
Pattern bool
// File and Line are where the Host line is.
File string
Line int
}
Entry is one host of the config as ssh would resolve it, defaults of matching pattern blocks included.
type ErrQuickOption ¶
type ErrQuickOption struct{ Option string }
ErrQuickOption is a command-line option quick connect does not take.
func (*ErrQuickOption) Error ¶
func (e *ErrQuickOption) Error() string
type Hop ¶
Hop is one host of a ProxyJump: [user@]host[:port].
func ParseJump ¶
ParseJump reads a ProxyJump value: comma-separated [user@]host[:port], or ssh:// URIs of the same.
func ParseQuick ¶
ParseQuick reads what quick connect takes: user@host:port, host, ssh://user@host:port, or an ssh command as "ssh -p 2222 user@host" (-p and -l read, options without an argument ignored).
func ParseTarget ¶
ParseTarget reads [user@]host[:port], the host an IPv6 address in brackets when it has a port.