sshconfig

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sshconfig 从 OpenSSH 配置中列出 Host 别名(Spec §4.1)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath 返回用户默认 ssh config 路径。

func ListHosts

func ListHosts(configPath string) ([]string, error)

ListHosts 解析主 config 中的 Host 行;排除含 * 或 ? 的模式。 S2 最低要求:主文件 Host 行;Include 递归为 should(此处做一层 Include 尽力解析)。

Types

type HostEntry

type HostEntry struct {
	Host      string
	User      string
	HostName  string
	Port      string
	ProxyJump string
}

HostEntry 表示一个非通配 Host 别名及其寻址字段(不探测网络)。

func ListHostEntries

func ListHostEntries(configPath string) ([]HostEntry, error)

ListHostEntries 解析 config,返回每个非通配 Host 别名的寻址字段。

Jump to

Keyboard shortcuts

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