Replace the one-intermediate-peer relay with protocol-scoped connectivity graphs and precomputed shortest-path/ECMP forwarding snapshots. Independent transport readers forward opaque transit frames without a plugin or TUN round trip. Carry source, destination, a bounded hop limit and stable flow tags; preserve end-to-end WireGuard links across topology changes. Classify IP flows before encryption and preserve their tags through the WireGuard pending queue. Add offline four-agent path-change coverage, loop and isolation tests, and an opt-in release forwarding microbenchmark. Bump control/data ALPNs while preserving persistent network identities and state. Also include the pending Windows Mainline idle-timeout fix and its regression test, using a reproducible vendored dependency patch. Validation: fmt, workspace Clippy with warnings denied, and 307 release tests passed. Two pre-existing Windows SQLite wipe failures were excluded; public DHT and the manual benchmark remain ignored by default. The forwarding microbenchmark measured 103 ns (64 B) and 202 ns (1280 B) per transit packet, excluding encryption and socket I/O.
57 lines
1.9 KiB
Rust
57 lines
1.9 KiB
Rust
use std::{
|
|
net::{Ipv4Addr, SocketAddrV4},
|
|
time::Duration,
|
|
};
|
|
|
|
use super::{ServerSettings, DEFAULT_REQUEST_TIMEOUT};
|
|
|
|
#[derive(Debug, Clone)]
|
|
/// Dht Configurations
|
|
pub struct Config {
|
|
/// Bootstrap nodes
|
|
///
|
|
/// Defaults to [super::DEFAULT_BOOTSTRAP_NODES]
|
|
pub bootstrap: Option<Vec<SocketAddrV4>>,
|
|
/// Explicit port to listen on.
|
|
///
|
|
/// Defaults to None
|
|
pub port: Option<u16>,
|
|
/// UDP socket request timeout duration.
|
|
///
|
|
/// The longer this duration is, the longer queries take until they are deemeed "done".
|
|
/// The shortet this duration is, the more responses from busy nodes we miss out on,
|
|
/// which affects the accuracy of queries trying to find closest nodes to a target.
|
|
///
|
|
/// Defaults to [DEFAULT_REQUEST_TIMEOUT]
|
|
pub request_timeout: Duration,
|
|
/// Server to respond to incoming Requests
|
|
pub server_settings: ServerSettings,
|
|
/// Whether or not to start in server mode from the get go.
|
|
///
|
|
/// Defaults to false where it will run in [Adaptive mode](https://github.com/pubky/mainline?tab=readme-ov-file#adaptive-mode).
|
|
pub server_mode: bool,
|
|
/// A known public IPv4 address for this node to generate
|
|
/// a secure node Id from according to [BEP_0042](https://www.bittorrent.org/beps/bep_0042.html)
|
|
///
|
|
/// Defaults to None, where we depend on suggestions from responding nodes.
|
|
pub public_ip: Option<Ipv4Addr>,
|
|
/// Address to bind to.
|
|
///
|
|
/// Defaults to 0.0.0.0 (all interfaces)
|
|
pub bind_address: Option<Ipv4Addr>,
|
|
}
|
|
|
|
impl Default for Config {
|
|
fn default() -> Self {
|
|
Self {
|
|
bootstrap: None,
|
|
port: None,
|
|
request_timeout: DEFAULT_REQUEST_TIMEOUT,
|
|
server_settings: Default::default(),
|
|
server_mode: false,
|
|
public_ip: None,
|
|
bind_address: None,
|
|
}
|
|
}
|
|
}
|