ReflectorConfig

Struct ReflectorConfig 

Source
#[non_exhaustive]
pub struct ReflectorConfig { pub callsign: Callsign, pub modules: HashSet<Module>, pub bind: SocketAddr, pub max_clients_per_module: usize, pub max_total_clients: usize, pub enabled_protocols: HashSet<ProtocolKind>, pub keepalive_interval: Duration, pub keepalive_inactivity_timeout: Duration, pub voice_inactivity_timeout: Duration, pub cross_protocol_forwarding: bool, pub tx_rate_limit_frames_per_sec: f64, }
Expand description

Complete configuration for a multi-client reflector.

Construct via Self::builder — the typestate builder enforces that callsign, modules, and bind are set before build is callable. All other fields carry defaults documented on ReflectorConfigBuilder.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§callsign: Callsign

Reflector’s own callsign (e.g. REF030).

§modules: HashSet<Module>

Modules this reflector exposes.

§bind: SocketAddr

UDP bind address.

§max_clients_per_module: usize

Maximum clients allowed per module.

§max_total_clients: usize

Maximum clients allowed across all modules.

§enabled_protocols: HashSet<ProtocolKind>

Which protocol endpoints are enabled.

Default: all three (DPlus, DExtra, DCS). Use ReflectorConfigBuilder::disable to remove one from the set before building.

§keepalive_interval: Duration

Interval between keepalive polls sent to each client.

§keepalive_inactivity_timeout: Duration

Inactivity window after which a silent client is evicted.

§voice_inactivity_timeout: Duration

Inactivity window after which a stalled voice stream is closed.

§cross_protocol_forwarding: bool

Whether voice from one protocol should be forwarded to clients on another protocol.

§tx_rate_limit_frames_per_sec: f64

Per-client TX rate limit, in voice frames per second.

Defaults to 60.0 (3× the nominal 20 fps D-STAR voice rate) so a legitimate voice stream never hits the limit, but a client trying to saturate the reflector with a burst of 200+ fps gets rate-limited. Set higher if you expect large bursts of legitimate traffic.

Implementations§

Source§

impl ReflectorConfig

Source

pub fn is_enabled(&self, protocol: ProtocolKind) -> bool

Check whether a specific protocol endpoint is enabled.

Source

pub fn builder() -> ReflectorConfigBuilder<Missing, Missing, Missing>

Start building a ReflectorConfig.

The returned builder is a typestate: ReflectorConfigBuilder::build only compiles when .callsign(), .module_set(), and .bind() have all been called. Skipping any of the three is a compile error — the type parameters flip from Missing to Provided as each setter is invoked.

§Example
use std::collections::HashSet;
use dstar_gateway_core::types::{Callsign, Module};
use dstar_gateway_server::ReflectorConfig;

let mut modules = HashSet::new();
let _ = modules.insert(Module::try_from_char('C')?);

let config = ReflectorConfig::builder()
    .callsign(Callsign::try_from_str("REF999")?)
    .module_set(modules)
    .bind("0.0.0.0:30001".parse()?)
    .disable(dstar_gateway_core::types::ProtocolKind::DPlus)
    .disable(dstar_gateway_core::types::ProtocolKind::Dcs)
    .build()?;
assert!(config.is_enabled(dstar_gateway_core::types::ProtocolKind::DExtra));

Trait Implementations§

Source§

impl Clone for ReflectorConfig

Source§

fn clone(&self) -> ReflectorConfig

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 ReflectorConfig

Source§

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

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