pub struct NetworkConfig {
pub bind_addr: Option<SocketAddr>,
pub bootstrap_nodes: Vec<SocketAddr>,
pub max_connections: u32,
pub connection_timeout: Duration,
pub stats_interval: Duration,
pub peer_cache_path: Option<PathBuf>,
pub pinned_bootstrap_peers: HashSet<[u8; 32]>,
pub inbound_allowlist: HashSet<[u8; 32]>,
pub max_peers_per_ip: u32,
pub port_mapping_enabled: bool,
}Expand description
x0x network node configuration.
This struct wraps ant-quic’s configuration with x0x-specific defaults optimized for gossip network participation.
Fields§
§bind_addr: Option<SocketAddr>Socket address to bind to. If None, a random port is chosen.
bootstrap_nodes: Vec<SocketAddr>Bootstrap nodes to connect to on startup.
max_connections: u32Maximum number of concurrent connections.
connection_timeout: DurationTimeout for establishing connections.
stats_interval: DurationInterval for collecting and reporting stats.
peer_cache_path: Option<PathBuf>Path to persist peer cache.
pinned_bootstrap_peers: HashSet<[u8; 32]>Pinned bootstrap peer IDs. When non-empty, dial_bootstrap() rejects
peers whose ID is not in this set. Prevents spoofed bootstrap nodes.
inbound_allowlist: HashSet<[u8; 32]>Inbound connection allowlist. When non-empty, spawn_accept_loop()
rejects connections from peers not in this set.
max_peers_per_ip: u32Max concurrent connections from a single IP. Default: 3.
port_mapping_enabled: boolX0X-0062 reviewer P2 #2: surface ant-quic’s best-effort UPnP IGD
port-mapping toggle at the x0x config layer so daemon operators on
networks without IGD support (or with policy against it) can
disable it. ant-quic’s default is true; x0x mirrors that. When
false, x0x calls port_mapping_enabled(false) on the ant-quic
builder, which skips the UPnP discovery task entirely.
Settable via the daemon’s TOML config (port_mapping_enabled = false)
and via the --no-port-mapping CLI flag.
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkConfig
impl Debug for NetworkConfig
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§impl<'de> Deserialize<'de> for NetworkConfig
impl<'de> Deserialize<'de> for NetworkConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnsafeUnpin for NetworkConfig
impl UnwindSafe for NetworkConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more