Skip to main content

ConnectionPolicyConfig

Struct ConnectionPolicyConfig 

Source
pub struct ConnectionPolicyConfig {
    pub strategy: Option<String>,
    pub direct_tcp_timeout_ms: Option<u64>,
    pub direct_udp_timeout_ms: Option<u64>,
    pub punch_timeout_ms: Option<u64>,
    pub heartbeat_interval_ms: Option<u64>,
    pub heartbeat_timeout_ms: Option<u64>,
    pub reconnect_base_delay_ms: Option<u64>,
    pub reconnect_multiplier: Option<f64>,
    pub reconnect_max_delay_ms: Option<u64>,
    pub reconnect_max_attempts: Option<u32>,
    pub reconnect_jitter_ratio: Option<f64>,
}
Expand description

Connection preference policy (ADR-0005 Phase 1).

Controls which transport paths are tried and in what order when connecting to a peer. The default strategy is "direct_then_relay".

[network.connection_policy]
strategy = "direct_then_relay"
direct_tcp_timeout_ms = 3000
direct_udp_timeout_ms = 1000
punch_timeout_ms = 5000
heartbeat_interval_ms = 30000
heartbeat_timeout_ms = 90000
reconnect_base_delay_ms = 1000
reconnect_multiplier = 2.0
reconnect_max_delay_ms = 60000
reconnect_max_attempts = 8
reconnect_jitter_ratio = 0.2

Fields§

§strategy: Option<String>

Strategy string.

ValueDescription
direct_onlyTCP only; no UDP, no relay.
direct_then_relayTCP, fall back to relay. (default)
direct_then_udp_then_relayTCP → direct UDP → relay.
direct_then_punch_then_relayTCP → UDP → hole-punch → relay. (Phase 3)
relay_onlySkip direct paths; use relay immediately.
§direct_tcp_timeout_ms: Option<u64>

Timeout for a direct TCP connect attempt (ms).

§direct_udp_timeout_ms: Option<u64>

Timeout for a direct UDP session attempt (ms).

§punch_timeout_ms: Option<u64>

Total time budget for relay-coordinated UDP hole punching (ms). Phase 3.

§heartbeat_interval_ms: Option<u64>

Interval between framework heartbeat probes for active peers (ms).

§heartbeat_timeout_ms: Option<u64>

Maximum time without inbound peer activity before the route is unresponsive (ms).

§reconnect_base_delay_ms: Option<u64>

Delay before the first automatic reconnect attempt (ms).

§reconnect_multiplier: Option<f64>

Exponential multiplier applied after each failed reconnect attempt.

§reconnect_max_delay_ms: Option<u64>

Maximum delay between automatic reconnect attempts (ms).

§reconnect_max_attempts: Option<u32>

Maximum consecutive reconnect attempts before automatic retries stop.

§reconnect_jitter_ratio: Option<f64>

Symmetric jitter ratio applied to reconnect delays, in the range 0.0..=1.0.

Trait Implementations§

Source§

impl Clone for ConnectionPolicyConfig

Source§

fn clone(&self) -> ConnectionPolicyConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionPolicyConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConnectionPolicyConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ConnectionPolicyConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V