DigipeaterConfig

Struct DigipeaterConfig 

Source
pub struct DigipeaterConfig {
    pub callsign: Ax25Address,
    pub uidigipeat_aliases: Vec<String>,
    pub uiflood_alias: Option<String>,
    pub uitrace_alias: Option<String>,
    pub dedup_ttl: Duration,
    pub viscous_delay: Duration,
    /* private fields */
}
Expand description

Digipeater configuration.

Controls which packets are relayed and how the digipeater path is modified. Also carries the rolling dedup cache used to suppress retransmission of packets seen more than once within DigipeaterConfig::dedup_ttl.

Fields§

§callsign: Ax25Address

Our callsign (used for UIdigipeat and UItrace path insertion).

§uidigipeat_aliases: Vec<String>

UIdigipeat aliases (e.g., ["WIDE1-1"]). Relay if path contains this alias, replace with our callsign + completion flag.

§uiflood_alias: Option<String>

UIflood alias base (e.g., "CA"). Relay and decrement hop count. The SSID encodes the remaining hop count.

§uitrace_alias: Option<String>

UItrace alias base (e.g., "WIDE"). Relay, decrement hop count, and insert our callsign in the path.

§dedup_ttl: Duration

How long a recently-seen packet is remembered in the dedup cache. Defaults to DEFAULT_DEDUP_TTL (30 s).

§viscous_delay: Duration

Viscous delay — how long to hold a relay candidate before actually transmitting it. 0 disables the feature (default).

Viscous digis defer relay for a short window so that nearby full digipeaters have a chance to transmit first; if any other digi relays the packet within the window, the viscous digi cancels its own pending relay. This lets a fill-in digi stay quiet in well-covered areas while still providing coverage in RF gaps.

Implementations§

Source§

impl DigipeaterConfig

Source

pub fn new( callsign: Ax25Address, uidigipeat_aliases: Vec<String>, uiflood_alias: Option<String>, uitrace_alias: Option<String>, ) -> DigipeaterConfig

Build a new config with an empty dedup cache and the default TTL.

Source

pub fn drain_ready_viscous(&mut self, now: Instant) -> Vec<Ax25Packet>

Drain any pending viscous relays whose delay window has elapsed.

Call this periodically (e.g. from the client event loop) to pick up relays whose viscous delay has expired without anyone else transmitting the same packet. Returns the frames ready to send.

The caller provides now so this module remains sans-io; pass the same Instant used for the surrounding Self::process calls.

Source§

impl DigipeaterConfig

Source

pub fn process(&mut self, packet: &Ax25Packet, now: Instant) -> DigiAction

Process an incoming AX.25 UI frame through digipeater logic.

Performs, in order:

  1. UI frame sanity (control=0x03, PID=0xF0).
  2. Own-callsign loop detection — if our callsign appears anywhere in the digipeater path with the H-bit set, the packet has already been through us and we must drop it to prevent routing loops.
  3. Dedup cache lookup — if we’ve relayed a packet with the same source/destination/info hash within Self::dedup_ttl, drop.
  4. First-unused entry alias matching (UIdigipeat, UIflood, UItrace).
  5. On successful relay, the packet hash is recorded in the dedup cache with the current time.

The caller provides now so this module remains sans-io. Passing the same Instant to every stateful call in a single loop iteration keeps timing invariants consistent.

Returns DigiAction::Drop if any check fails or no alias matches.

Source

pub fn dedup_cache_len(&self) -> usize

Number of entries currently in the dedup cache (for tests/metrics).

Trait Implementations§

Source§

impl Clone for DigipeaterConfig

Source§

fn clone(&self) -> DigipeaterConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DigipeaterConfig

Source§

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

Formats the value using the given formatter. 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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more