knownhosts

package
v0.166.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 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

Overview

Package knownhosts gives a run's commands a known_hosts file Go's SSH clients can read. golang.org/x/crypto/ssh/knownhosts, which go-git's SSH transport uses, refuses a whole file for one line whose key type it does not know (a post-quantum host key OpenSSH accepts, for one), so every go-git SSH test of a machine whose known_hosts holds such a line fails. Parseable writes the machine's known_hosts without those lines to a file of its own, for the command's SSH_KNOWN_HOSTS; the machine's files stay untouched.

Index

Constants

View Source
const Env = "SSH_KNOWN_HOSTS"

Env is the variable go-git reads its known_hosts files from, a list separated like PATH; set, it replaces the default files.

Variables

This section is empty.

Functions

func Defaults

func Defaults(home string) []string

Defaults are the files go-git reads when Env is unset, home first: ~/.ssh/known_hosts and /etc/ssh/ssh_known_hosts.

func Parseable

func Parseable(dst string, srcs ...string) (dropped int, err error)

Parseable writes the lines of srcs that Go's knownhosts parses to dst and reports how many lines it dropped. With nothing dropped it writes no file and returns 0: the sources serve as they are. A missing source counts as empty. dst is replaced atomically, so concurrent runs read a whole file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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