sshconfig

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT 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 sshconfig reads the control plane's ~/.ssh/config so its hosts can become Lectern targets in one click (docs/ssh.md).

The host list comes from the file itself (Host lines, following Include). What each host resolves to comes from `ssh -G <alias>` when OpenSSH is installed, so Match blocks, wildcards and defaults resolve exactly as ssh would resolve them; without it, a small first-match-wins reader of the same file stands in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aliases

func Aliases(path string) ([]string, error)

Aliases lists every concrete Host name in the file: no wildcards, no negations, each once, in file order.

func DefaultPath

func DefaultPath() string

DefaultPath is ~/.ssh/config for the user Lectern runs as.

Types

type Host

type Host struct {
	Alias         string   `json:"alias"`
	HostName      string   `json:"hostname"`
	User          string   `json:"user"`
	Port          int      `json:"port"`
	IdentityFiles []string `json:"identity_files,omitempty"`
	ProxyJump     string   `json:"proxy_jump,omitempty"`
	ProxyCommand  bool     `json:"proxy_command,omitempty"`
	ForwardAgent  bool     `json:"forward_agent,omitempty"`
	GSSAPI        bool     `json:"gssapi,omitempty"`
	IdentityAgent string   `json:"identity_agent,omitempty"`
	// SecurityKey is set when an identity file is a FIDO2 (sk-) key.
	SecurityKey bool `json:"security_key,omitempty"`
	// Resolver says how the values were found: "ssh -G" or "file".
	Resolver string `json:"resolver"`
}

Host is one concrete alias and what it resolves to.

func List

func List(ctx context.Context, path string) ([]Host, error)

List resolves every alias in the file.

func Resolve

func Resolve(ctx context.Context, path, alias string) Host

Resolve reports what alias connects to, through `ssh -G` when available.

Jump to

Keyboard shortcuts

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