Involved Source Files
Package knownhosts implements a parser for the OpenSSH known_hosts
host key database, and provides utility functions for writing
OpenSSH compliant known_hosts files.
Package-Level Type Names (total 10, in which 3 are exported)
/* sort exporteds by: | */
KeyError is returned if we did not find the key in the host key
database, or there was a mismatch. Typically, in batch
applications, this should be interpreted as failure. Interactive
applications can offer an interactive prompt to the user.
Want holds the accepted host keys. For each key algorithm,
there can be one hostkey. If Want is empty, the host is
unknown. If Want is non-empty, there was a mismatch, which
can signify a MITM attack.
(*T) Error() string
*T : error
lines[]keyDBLine
Serialized version of revoked keys
IsAuthorityForHost can be used as a callback in ssh.CertChecker
IsRevoked can be used as a callback in ssh.CertChecker
The Read function parses file contents.
check checks a key against the host database. This should not be
used for verifying certificates.
checkAddr checks if we can find the given public key for the
given address. If we only find an entry for the IP address,
or only the hostname, then this still succeeds.
(*T) parseLine(line []byte, filename string, linenum int) error
func newHostKeyDB() *hostKeyDB
Package-Level Functions (total 15, in which 4 are exported)
HashHostname hashes the given hostname. The hostname is not
normalized before hashing.
Line returns a line to add append to the known_hosts files.
New creates a host key callback from the given OpenSSH host key
files. The returned callback is for use in
ssh.ClientConfig.HostKeyCallback. By preference, the key check
operates on the hostname if available, i.e. if a server changes its
IP address, the host key check will still succeed, even though a
record of the new IP address is not available.
Normalize normalizes an address into the form used in known_hosts
See
https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/addrmatch.c
The matching of * has no regard for separators, unlike filesystem globs
Package-Level Constants (total 3, none are exported)
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.