knownhosts

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0, BSD-3-Clause Imports: 13 Imported by: 8 modules, 6 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(b []byte) (ssh.HostKeyCallback, []string, error)

New creates a host key callback from the given OpenSSH host key file bytes. 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.

Types

type KnownKey added in v0.4.0

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

func ParseKnownHosts added in v0.4.0

func ParseKnownHosts(s string) ([]KnownKey, error)

ParseKnownHosts takes a string with the contents of known_hosts, parses it and returns a slice of KnownKey

func (KnownKey) Matches added in v0.4.0

func (k KnownKey) Matches(host string, fingerprint []byte) bool

Matches checks if the specified host is present and if the fingerprint matches the present public key key.

Jump to

Keyboard shortcuts

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