Commit 3c3f779
authored
feat: M13.2 — AnvilSession::connect_via_proxy_command (FR-55) (#10)
Adds the public constructor that consumes the ProxyCommand template
captured into ResolvedSshConfig in M12 and the building blocks landed
in M13.1 (token expansion + ChildStdio adapter).
session.rs:
- New private HandlerPieces struct + Self::build_handler_pieces helper
factor out the russh config + GitwayHandler + auth_banner +
verified_fingerprint mutex setup that connect() and the new
connect_via_proxy_command both need. M13.4's connect_via_jump_hosts
will reuse the same helper. The host-key fingerprint lookup
(with the StrictHostKeyChecking::AcceptNew tolerance shipped in
M12.5) lives there now, in one place.
- pub async fn connect_via_proxy_command(config, template, alias):
1. Reject the literal `none` (case-insensitive) — that's the FR-59
disable sentinel; callers should reach for connect() instead.
The ssh_config resolver preserves `none` as a literal so first-
wins protects it; the dispatcher in M13.6 turns that into a
call to connect() rather than this method.
2. Build the handler via build_handler_pieces.
3. Spawn the ProxyCommand child via crate::proxy::command::
spawn_proxy_command (token-expanded against config.host /
config.port / config.username / alias).
4. Hand the resulting ChildStdio (AsyncRead+AsyncWrite+Unpin+Send)
to russh::client::connect_stream. russh drives the SSH
handshake over the child's stdio.
5. Return the AnvilSession with the same shape as connect() —
indistinguishable to callers thereafter.
- The existing connect() now calls build_handler_pieces too; behavior
is identical (same russh::client::connect call, same handler).
proxy/mod.rs:
- Removed the M13.1-era #![allow(dead_code)]; spawn_proxy_command and
ChildStdio::new are now used by session.rs.
Tests: 173 lib + 1 matrix + 6 integration; 0 failures.
Plan: M13.2 of let-us-plan-on-bright-cosmos.md. Stacked on M13.1 (PR #6).1 parent f7f30e7 commit 3c3f779
2 files changed
Lines changed: 113 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 3 | | |
12 | 4 | | |
13 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 196 | + | |
191 | 197 | | |
192 | | - | |
193 | | - | |
194 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
| |||
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
232 | 261 | | |
233 | 262 | | |
234 | | - | |
235 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
236 | 269 | | |
237 | 270 | | |
238 | 271 | | |
239 | 272 | | |
240 | 273 | | |
241 | | - | |
242 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
243 | 342 | | |
244 | 343 | | |
245 | 344 | | |
| |||
0 commit comments