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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! The Tailscale control-plane transport, known upstream as ts2021.
//!
//! A TCP connection carrying a Noise IK handshake, then a record layer, and
//! HTTP/2 inside that. This crate covers everything below the HTTP/2: the
//! bootstrap over HTTP/1.1, the handshake, the framing, and the early payload
//! the server sends before its HTTP/2 preface.
//!
//! # Sans-io
//!
//! Nothing here touches a socket. Functions take the bytes that arrived and
//! write the bytes to send, so the same code runs under `cargo test` on the
//! host, on the harness's reactor, and later on embassy-net. It also means the
//! whole protocol can be replayed against a captured session.
//!
//! # Where the constants come from
//!
//! Every byte-level constant in this crate was read out of
//! `tests/vectors/ts2021-session.pcap` — a real tailscaled 1.94.2 registering
//! with a real Headscale v0.29.3 — not from documentation. Each is commented
//! with what the capture showed. The one that matters most is in [`record`]:
//! the record nonce counter is **big-endian**, where WireGuard's is
//! little-endian, and the two agree at counter zero. An implementation that
//! gets this wrong completes the handshake, exchanges one correct record, and
//! then fails.
pub use ;
pub use ;
pub use ;
/// The capability version this client advertises.
///
/// It appears in three places that must agree: the `?v=` on `/key`, the
/// big-endian version field at the front of the initiation, and — critically —
/// the Noise prologue, which binds it into the handshake so it cannot be
/// downgraded by an attacker rewriting the header.
///
/// 131 is what tailscaled 1.94.2 sent in the captured session. The lab's
/// Headscale rejects anything below 113, recorded in
/// `tests/vectors/server_key.json`; that floor rises as servers are upgraded,
/// which is why it is probed rather than assumed.
pub const CAPABILITY_VERSION: u16 = 131;