Skip to main content

Module pattern

Module pattern 

Source
Expand description

OpenSSH host-pattern matching.

Implements Host keyword wildcard semantics: *, ?, [charset], [!charset]/[^charset], [a-z] ranges and !pattern negation. All functions here are pure; they own no state and depend only on PatternEntry from the model module.

Functionsยง

host_pattern_matches
Check whether a Host pattern matches a given alias. OpenSSH Host keyword matches only against the target alias typed on the command line, never against the resolved HostName.
is_host_pattern
Does this pattern contain any SSH wildcard metacharacters?
proxy_jump_contains_self
Returns true if any hop in a (possibly comma-separated) ProxyJump value matches the given alias. Strips optional user@ prefix and :port suffix from each hop before comparing. Handles IPv6 bracket notation [addr]:port. Used to detect self-referencing loops.
ssh_pattern_match
Match a text string against an SSH host pattern. Supports * (any sequence), ? (single char), [charset] (character class), [!charset]/[^charset] (negated class), [a-z] (ranges) and !pattern (negation).