Skip to main content

parse_jump_chain

Function parse_jump_chain 

Source
pub fn parse_jump_chain(raw: &str) -> Result<Vec<JumpHost>, AnvilError>
Expand description

Parses a comma-separated ProxyJump chain into ordered JumpHosts.

Accepts the -J / ProxyJump syntax: [user@]host[:port][,…]. Whitespace around commas is ignored. The literal none (single element, case-insensitive) is rejected here — callers that recognize none as the FR-59 disable sentinel should detect it before calling this function and fall back to a direct connection.

§Errors

  • The string is empty or contains only commas / whitespace.
  • An entry has an empty host (@, :22, or just whitespace).
  • An entry has an empty user-portion (@host).
  • The port portion is not parseable as u16.
  • The chain length exceeds MAX_JUMP_HOPS.
  • The literal none is used (callers should handle this before calling).