#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.callsign: CallsignReflector’s own callsign (e.g. REF030).
modules: HashSet<Module>Modules this reflector exposes.
bind: SocketAddrUDP bind address.
max_clients_per_module: usizeMaximum clients allowed per module.
max_total_clients: usizeMaximum 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: DurationInterval between keepalive polls sent to each client.
keepalive_inactivity_timeout: DurationInactivity window after which a silent client is evicted.
voice_inactivity_timeout: DurationInactivity window after which a stalled voice stream is closed.
cross_protocol_forwarding: boolWhether voice from one protocol should be forwarded to clients on another protocol.
tx_rate_limit_frames_per_sec: f64Per-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
impl ReflectorConfig
Sourcepub fn is_enabled(&self, protocol: ProtocolKind) -> bool
pub fn is_enabled(&self, protocol: ProtocolKind) -> bool
Check whether a specific protocol endpoint is enabled.
Sourcepub fn builder() -> ReflectorConfigBuilder<Missing, Missing, Missing>
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
impl Clone for ReflectorConfig
Source§fn clone(&self) -> ReflectorConfig
fn clone(&self) -> ReflectorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more