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
//! WireGuard Next-Generation Secure Network Tunnel (`Noise_IKpsk2`) AST definitions.
//!
//! Defines the modern cryptographic VPN protocol designed by Jason A. Donenfeld and carried over
//! UDP port `51820`. WireGuard combines the `Noise_IKpsk2` handshake framework (Curve25519 ECDH,
//! BLAKE2s hashing, HKDF, and ChaCha20-Poly1305 AEAD) with four fixed-layout little-endian message
//! types: Type `1` Handshake `INITIATION` (`148` bytes, carrying `sender_index`, 32B ephemeral key,
//! 48B encrypted static key, 28B encrypted TAI64N timestamp, and two 16B BLAKE2s MACs), Type `2`
//! Handshake `RESPONSE` (`92` bytes, carrying `sender_index` and `receiver_index`), Type `3` `COOKIE`
//! Reply (`64` bytes, carrying `receiver_index`, 24B XChaCha20-Poly1305 nonce, and 32B encrypted cookie
//! for DoS mitigation), and Type `4` Transport `DATA` (`16`B header with `receiver_index` and 64-bit `counter`).
//!
//! Canonical `.fasm` syntax:
//! `a -> b WIREGUARD [TYPE <INITIATION|RESPONSE|COOKIE|DATA> | INITIATION | COOKIE | DATA] [SENDER <u32>] [RECEIVER <u32>] [COUNTER <u64>] [PAYLOAD "<str>" | HEXPAYLOAD "<hex>"]`
use PhantomData;
/// WireGuard protocol message type (`1..=4`).
/// WireGuard cryptographic VPN tunnel specification over UDP port `51820`.
///
/// Syntax mapping: `WIREGUARD [TYPE <INITIATION|RESPONSE|COOKIE|DATA> | INITIATION | COOKIE | DATA] [SENDER <u32>] [RECEIVER <u32>] [COUNTER <u64>]`