Skip to content

Commit 4b4a353

Browse files
committed
add comment
1 parent 6e18c92 commit 4b4a353

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ssh/knownhosts/reader.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import (
66
"golang.org/x/crypto/ssh"
77
)
88

9+
// NewFromReader creates a host key callback from the given OpenSSH host io.Reader
10+
// which is in SSH_KNOWN_HOSTS_FILE_FORMAT. The returned callback is for use in
11+
// ssh.ClientConfig.HostKeyCallback. By preference, the key check
12+
// operates on the hostname if available, i.e. if a server changes its
13+
// IP address, the host key check will still succeed, even though a
14+
// record of the new IP address is not available.
915
func NewFromReader(r io.Reader) (ssh.HostKeyCallback, error) {
1016
db := newHostKeyDB()
1117
if err := db.Read(r, ""); err != nil {

0 commit comments

Comments
 (0)