README

jingmo653/sshconfig-resolve/pattern does not have a README file

#
PatternError

pub(all) suberror PatternError {
EmptyPatternList
EmptyPattern(index~ : Int)
PatternTooLong(length~ : Int, limit~ : Int)
TooManyPatterns(count~ : Int, limit~ : Int)
MissingMatchArgument(condition~ : String)
InvalidAllCondition
UnsupportedMatchCondition(name~ : String)
} derive(Eq,
Debug
)

Structured failures produced while compiling a bounded pattern-list.

#
CompiledPattern

type CompiledPattern derive(Eq,
Debug
)

#
MatchContext

pub(all) struct MatchContext {
host : String
original_host : String
remote_user : String?
local_user : String?
tags : Array[String]
} derive(Eq,
Debug
)

The context required to evaluate OpenSSH Match conditions without a dependency on the resolver's own context type.

#
MatchContext::new

fn MatchContext::new(host : String, original_host? : String, remote_user? : String, local_user? : String, tags? : Array[String]) -> MatchContext

Construct a Match context. original_host defaults to host because the common non-canonicalized path preserves the original user input.

#
MatchPredicate

pub(all) enum MatchPredicate {
All
Not(MatchPredicate)
Host(PatternList)
OriginalHost(PatternList)
User(PatternList)
LocalUser(PatternList)
Tagged(PatternList)
} derive(Eq,
Debug
)

P0 Match predicates. Unsupported OpenSSH conditions are rejected by the parser instead of being represented here, so this enum is always safe to evaluate without shelling out or canonicalizing a hostname.

#
MatchPredicate::decide

Evaluate a Match predicate. Tagged succeeds if any tag matches its pattern-list; it does not require every tag to match.

#
MatchPredicate::matches

fn MatchPredicate::matches(self : MatchPredicate, context : MatchContext) -> Bool

Evaluate a Match predicate without recording explain information.

#
PatternDecision

pub(all) struct PatternDecision {
matched : Bool
positive_index : Int?
negative_index : Int?
} derive(Eq,
Debug
)

Explainable result of evaluating a pattern-list. Indices refer to the original input array, are zero-based, and remain populated even when a negative item excludes a matching positive item.

#
PatternList

pub struct PatternList {
patterns : Array[CompiledPattern]
} derive(Eq,
Debug
)

A checked OpenSSH pattern-list. Construct it with compile_pattern_list before using it in a resolver or Match condition.

#
PatternList::decide

fn PatternList::decide(self : PatternList, value : String) -> PatternDecision

Evaluate a checked list against a value. A matching negative pattern has precedence regardless of where it appears in the list.

#
PatternList::matches

fn PatternList::matches(self : PatternList, value : String) -> Bool

Evaluate a checked list without recording explain information.

#
compile_pattern_list

fn compile_pattern_list(patterns : Array[String]) -> PatternList raise PatternError

Compile a pattern-list using the P0 resource limits.

#
compile_pattern_list_with_limits

fn compile_pattern_list_with_limits(patterns : Array[String], pattern_length_limit? : Int, pattern_count_limit? : Int) -> PatternList raise PatternError

Compile a pattern-list with caller-supplied limits. This is useful for fuzzing and for embedders which need tighter request budgets.

#
default_match_value_length_limit

let default_match_value_length_limit : Int

Maximum accepted host or Match-context value length.

#
default_pattern_length_limit

let default_pattern_length_limit : Int

Maximum accepted pattern length for the bounded public matching APIs.

#
default_pattern_list_limit

let default_pattern_list_limit : Int

Maximum number of entries accepted by one compiled pattern-list.

#
host_matches

fn host_matches(pattern : String, host : String) -> Bool

Match one case-insensitive OpenSSH host glob containing * and ?.

This P0 matcher folds ASCII only. Inputs exceeding default_pattern_length_limit (or the value limit) are rejected as a non-match so that the compatibility Bool API remains allocation-free and non-throwing.

#
parse_match_predicate

fn parse_match_predicate(condition : String, arguments : Array[String]) -> MatchPredicate raise PatternError

Parse one normalized Match condition and its pattern-list arguments. exec, canonical, final, and unknown conditions deliberately produce UnsupportedMatchCondition: P0 never executes a command or guesses an OpenSSH canonicalization phase.

#
parse_match_predicates

fn parse_match_predicates(tokens : Array[String]) -> Array[MatchPredicate] raise PatternError

Parse interleaved Match tokens such as ["host", "*.corp", "user", "deploy,admin"]. Every condition other than all consumes its following comma-separated pattern-list token.

#
patterns_match

fn patterns_match(patterns : Array[String], host : String) -> Bool

Match an OpenSSH pattern-list. A matching negated item always excludes the host; otherwise at least one positive item must match.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io