1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Generator-shape coroutine driver mirroring `core::ops::Coroutine`:
//! a `Yield` associated type for intermediate progress, a `Return` for
//! terminal output, and a two-variant [`ProxyCoroutineState`]
//! (`Yielded` / `Complete`). Shared by every proxy protocol.
use Vec;
/// State yielded by a [`ProxyCoroutine::resume`] step.
/// Standard-shape proxy coroutine: owns its internal state, declares a
/// per-step `Yield`, and returns `Result<Output, Error>` on completion.
/// I/O request emitted by a yielded coroutine step.
///
/// [`WantsRead`] carries an exact byte count rather than an open-ended
/// "read some": the pump reads exactly that many bytes (e.g. via
/// `read_exact`) and never consumes tunnel payload that arrives right
/// after the handshake. Length-framed protocols (SOCKS5) request whole
/// messages; delimiter-framed ones (HTTP CONNECT) request one byte at a
/// time while scanning.
///
/// [`WantsRead`]: ProxyYield::WantsRead