tor_protover/named.rs
1//! Define protocol versions by name.
2//!
3//! Protocol versions obsolete at the time of this writing (Mar 2025)
4//! are not included.
5//!
6//! For more details about specific versions,
7//! see the [relevant section of the spec][spec].
8//!
9//! [spec]: https://spec.torproject.org/tor-spec/subprotocol-versioning.html
10
11use super::{NamedSubver, ProtoKind};
12use paste::paste;
13
14/// Helper: define a set of named aliases for specific subprotocol versions
15macro_rules! def_named {
16 { $( $protocol:ident {
17 $(
18 $(#[$meta:meta])*
19 $subver:ident = $num:expr;
20 )*
21 })*
22 } => {paste!{
23 $($(
24 $(#[$meta])*
25 pub const [<$protocol:upper _ $subver>] : NamedSubver = NamedSubver::new(ProtoKind::$protocol, $num);
26 )*)*
27 }}
28}
29
30def_named! {
31
32 Link {
33 /// Obsolete version 1 link protocol.
34 ///
35 /// This protocol used RSA-based TLS certificate chains with specific properties.
36 V1 = 1;
37 /// Obsolete version 2 link protocol.
38 ///
39 /// This protocol used TLS renegotiation.
40 V2 = 2;
41 /// Version 3 link protocol.
42 ///
43 /// This protocol uses a single server certificate in TLS,
44 /// and then exchanges additional certificates and authentication
45 /// within the protocol.
46 V3 = 3;
47 /// Version 4 link protocol.
48 ///
49 /// This protocol extends the version 3 link protocol
50 /// by changing the length of Circuit IDs from 2 bytes to 4 bytes.
51 V4 = 4;
52 /// Version 5 link protocol.
53 ///
54 /// This protocol extends the version 4 link protocol
55 /// by adding support for link padding.
56 V5 = 5;
57 }
58
59 LinkAuth {
60 /// TLS authentication based on signing key-exported material with an Ed25519 key.
61 ///
62 /// ([Specification](https://spec.torproject.org/tor-spec/negotiating-channels.html#Ed25519-SHA256-RFC5705))
63 ED25519_SHA256_EXPORTER = 3;
64 }
65
66 Relay {
67 /// Support for ntor key exchange, CREATE2, CREATED2, EXTEND2, EXTENDED2.
68 NTOR = 2;
69
70 /// Support for extending over IPv6 properly using EXTEND2 messages.
71 EXTEND_IPv6 = 3;
72
73 /// Support for ntor v3 key exchange, including "extra data" in circuit handshakes
74 /// in the format described in
75 /// [the "ntor-v3" handshake](https://spec.torproject.org/tor-spec/create-created-cells.md#ntor-v3).
76 NTORV3 = 4;
77
78 /// Support for the ntorv3 [protocol request extension][prop346].
79 ///
80 /// (Reserved.)
81 ///
82 /// [prop346]: https://spec.torproject.org/proposals/346-protovers-again.html
83 NEGOTIATE_SUBPROTO = 5;
84 }
85
86 HSIntro {
87 /// Version 3 hidden service introduction point support.
88 V3 = 4;
89
90 /// Support for rate-limiting anti-DOS extensions in the`ESTABLISH_INTRO` message.
91 RATELIM = 5;
92 }
93
94 HSRend {
95 /// Support for RENDEZVOUS2 messages of arbitrary length.
96 V3 = 2;
97 }
98
99 HSDir {
100 /// Support for version 3 hidden service descriptors,
101 /// including blinded keys.
102 V3 = 2;
103 }
104
105 DirCache {
106 /// Support for consensus diffs.
107 CONSDIFF = 2;
108 }
109
110 Desc {
111 /// Support for signing with ed25519 keys,
112 /// and cross-signing with onion keys.
113 CROSSSIGN = 2;
114
115 /// Support for parsing relay descriptors without TAP onion-keys (`KP_onion_tap`),
116 /// and generating them without TAP onion keys when `publish-dummy-tap-key` is 0.
117 NO_TAP = 3;
118
119 /// Support for understanding and building paths according to
120 /// the "happy families" design.
121 FAMILY_IDS = 4;
122 }
123
124 Microdesc {
125 /// Support for generating and parsing microdescriptors with Ed25159 identities
126 /// (`KP_relayid_ed`)
127 ED25519_KEY = 2;
128
129 /// Support for parsing microdescriptors without TAP keys (`KP_onion_tap``).
130 NO_TAP = 3;
131 }
132
133 Cons {
134 /// Support for consensus method 21, which moved ed25519 identity keys (`KP_relayid_ed`)
135 /// to microdescriptors.
136 ED25519_MDS = 2;
137 }
138
139 Padding {
140 /// Support for padding machines to hide HS circuit setup patterns.
141 MACHINES_CIRC_SETUP = 2;
142 }
143
144 FlowCtrl {
145 /// Support for authenticated circuit-level SENDME messages.
146 AUTH_SENDME = 1;
147
148 /// Support for congestion control.
149 CC = 2;
150 }
151
152 Conflux {
153 /// Support for the core conflux protocol.
154 BASE = 1;
155 }
156
157}