Expand description
ssh_config(5) parser and resolver for Anvil.
Implements the subset of OpenSSH ssh_config directives required by
Gitway PRD §5.8.1. Layered as:
- [
lexer] — line-oriented tokenizer. Strips comments, joins continuation lines, splits on whitespace honoring quoted arguments, recognizes thekeyword=valueform. Also exposes argument-level helpers ([lexer::expand_tilde], [lexer::expand_env], [lexer::wildcard_match]) used by include resolution and the directive resolver. - [
parser] — groups token lines into Host blocks, handling implicit global directives (before the firstHost) and theMatchkeyword. include— recursively resolvesIncludedirectives, with tilde/env expansion, glob matching on the final component, a 16-deep nesting limit, and cycle detection by canonicalized path.- [
matcher] — flattens parsed blocks to the directives that apply to a given host, honoring positive/negated patterns and case- insensitive comparison.Matchblocks are silently skipped per PRD §12 Q1. - [
resolver] — public entry point. Composes the above into oneresolvecall returning aResolvedSshConfigwith first-wins precedence and per-directive provenance.
Match blocks are explicitly deferred to v1.1 per PRD §12 Q1; they
are recognized at parse time so directive grouping stays correct,
but never match a host.
Only the items re-exported below are part of the crate’s public API; the sub-modules themselves are crate-private building blocks.
Structs§
- AlgList
- A list of algorithm names from a
ssh_configdirective (HostKeyAlgorithms,KexAlgorithms,Ciphers,MACs). - Directive
Source - Provenance for one resolved directive — which file and line it came
from. Used by the
gitway diagline (NFR-24) andgitway config showto attribute each value back to its source. - Resolved
SshConfig - Fully-resolved
ssh_configfor one host. - SshConfig
Paths - Locations of the
ssh_configfiles to read during aresolvecall.
Enums§
- Strict
Host KeyChecking StrictHostKeyCheckingdirective value.
Functions§
- resolve
- Resolves the effective
ssh_configforhostagainst the files listed inpaths.