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
/// Wire-compatibility version for the control handshake and every
/// per-protocol test framing. Bump on ANY incompatible change to a test
/// protocol or the manifest shape. Distinct from `CARGO_PKG_VERSION`
/// (binary semver) and `REPORT_SCHEMA_VERSION` (report serialization).
/// The client requires an exact match against the server's value and
/// aborts before running any test otherwise.
pub const PROTOCOL_VERSION: u32 = 1;
/// Default port for the control / handshake endpoint — the one port a
/// user normally picks. Every other listener binds an OS-assigned
/// ephemeral port and is discovered via the control manifest.
pub const DEFAULT_CONTROL_PORT: u16 = 9000;
/// Legacy per-protocol default ports. Used only as fallbacks when an
/// explicit `--<proto>-port` override is supplied; the normal path
/// binds ephemeral ports (`:0`) and advertises them in the manifest.
pub const DEFAULT_TCP_PORT: u16 = 5201;
pub const DEFAULT_UDP_PORT: u16 = 5201;
pub const DEFAULT_HTTP_PORT: u16 = 8080;
pub const DEFAULT_HTTPS_PORT: u16 = 8443;
pub const DEFAULT_TCP_PAYLOAD_SIZES: & = &; // 1KB, 8KB, 64KB
/// Largest UDP DATA payload that fits in a single IPv4 datagram: the
/// 65507-byte IPv4 UDP payload maximum minus the 24-byte blaster DATA
/// header (see `DataPacketWriter::HEADER_LEN`). A larger payload makes the
/// datagram exceed 65507 B, so the send fails with EMSGSIZE and no packets
/// reach the wire.
pub const MAX_UDP_PAYLOAD_SIZE: usize = 65_507 - 24; // 65483
pub const DEFAULT_UDP_PAYLOAD_SIZES: & = &; // 1 KiB, 8 KiB, max single datagram
pub const DEFAULT_HTTP_PAYLOAD_SIZES: & =
&; // 1MB, 10MB, 100MB
/// Maximum allowed upload size for HTTP requests.
pub const MAX_HTTP_UPLOAD_SIZE: usize = 100 * 1024 * 1024 * 1024; // 100GiB
pub const DEFAULT_CHUNK_SIZE: usize = 1024 * 1024; // 1MB
// HTTP/2 flow-control tuning. The h2 defaults (64 KiB stream *and* connection
// windows) throttle throughput badly on a fast, low-latency path: every
// multiplexed stream shares one 64 KiB connection window, so in-flight data is
// capped at 64 KiB and a WINDOW_UPDATE round-trip is needed every 64 KiB. These
// larger windows keep the pipe full. They bound per-connection receive
// buffering, trading a few MiB of memory per connection for throughput.
pub const HTTP2_STREAM_WINDOW: u32 = 8 * 1024 * 1024; // 8 MiB
pub const HTTP2_CONNECTION_WINDOW: u32 = 32 * 1024 * 1024; // 32 MiB
/// Larger frames mean less per-frame framing/CPU overhead on bulk transfers.
pub const HTTP2_MAX_FRAME_SIZE: u32 = 64 * 1024; // 64 KiB
/// Per-connection send buffer for the HTTP/2 server. hyper's default is only
/// 400 KB (`DEFAULT_MAX_SEND_BUF_SIZE`), which throttles h2c/HTTPS badly:
/// because all multiplexed streams of a connection share one send buffer, a
/// suite that runs N "parallel" downloads over a *single* h2 connection (h2
/// multiplexes by default) repeatedly fills 400 KB, blocks the send task, and
/// transfers in stop-and-go bursts — collapsing loopback throughput to tens of
/// Mbps. HTTP/1 never hits this because it opens N independent TCP connections,
/// each with its own kernel send buffer. Raising this to match the stream
/// window keeps the single shared connection saturated.
pub const HTTP2_MAX_SEND_BUF: usize = 8 * 1024 * 1024; // 8 MiB