Skip to main content

anvil_ssh/proxy/
mod.rs

1// SPDX-License-Identifier: GPL-3.0-or-later
2// Rust guideline compliant 2026-03-30
3//! `ProxyCommand` and `ProxyJump` consumers (PRD §5.8.2, M13).
4//!
5//! M12 captured `proxy_command` and `proxy_jump` losslessly into
6//! [`super::ssh_config::ResolvedSshConfig`] so `gitway config show`
7//! mirrors `ssh -G`.  This module is what M13 uses to actually *consume*
8//! those values when establishing the underlying SSH transport:
9//!
10//! - [`tokens::expand_proxy_tokens`] expands `%h %p %r %n %%` in a
11//!   `ProxyCommand` template.
12//! - [`stdio::ChildStdio`] wraps a [`tokio::process::Child`]'s stdio in
13//!   the [`AsyncRead + AsyncWrite + Unpin + Send`] surface that
14//!   [`russh::client::connect_stream`] expects.
15//! - [`command::spawn_proxy_command`] glues the two together: token-
16//!   expand the template, spawn through the platform shell (`sh -c` on
17//!   Unix, `cmd /C` on Windows), capture stdio.
18//!
19//! Higher-level wiring — [`super::session::AnvilSession::connect_via_proxy_command`]
20//! and `connect_via_jump_hosts` — lands in M13.2 and M13.4.  The
21//! jump-string parser and chain manager (`jump.rs`) land alongside
22//! M13.3 and M13.4.
23
24pub(crate) mod command;
25pub mod jump;
26pub(crate) mod stdio;
27pub mod tokens;
28
29pub use jump::{parse_jump_chain, JumpHost, MAX_JUMP_HOPS};
30pub use tokens::expand_proxy_tokens;