dstar_gateway/
lib.rs

1#![doc = include_str!("../README.md")]
2//! Async tokio shell for the `dstar-gateway-core` D-STAR reflector library.
3//!
4//! This crate provides the async API consumers will use: `AsyncSession<P>`
5//! built on top of the sans-io typestate `Session<P, S>` in the core crate.
6//!
7//! # Architecture
8//!
9//! `dstar-gateway-core` is the **runtime-agnostic, I/O-free** sans-io core.
10//! It contains the codecs and typestate session machines. This crate wraps
11//! that core in a `tokio::net::UdpSocket`-backed driver loop, spawns it as
12//! a task, and exposes an [`tokio_shell::AsyncSession`] handle with
13//! `send_header` / `send_voice` / `send_eot` / `disconnect` methods.
14//!
15//! ```text
16//! [your app] <--AsyncSession--> [SessionLoop task] <--UdpSocket--> [Reflector]
17//!                                        |
18//!                                   Session<P, Connected>
19//!                                   (sans-io core)
20//! ```
21//!
22//! # Feature flags
23//!
24//! - `blocking` — additionally compiles a blocking-shell variant
25//!   (no tokio dependency at runtime) under the `blocking_shell`
26//!   module. Useful for CLI scripts and test fixtures that don't
27//!   want a tokio runtime.
28//! - `hosts-fetcher` — pulls `reqwest` for downloading Pi-Star host
29//!   files under the `hosts_fetcher` module. Disabled by default so
30//!   the crate stays dependency-light for consumers who don't need
31//!   HTTP.
32//!
33//! # Core re-exports
34//!
35//! The core types are re-exported from `dstar-gateway-core` for
36//! consumer convenience, so downstream crates don't need a separate
37//! `dstar-gateway-core` dependency for the common types.
38
39pub mod auth;
40pub mod tokio_shell;
41
42#[cfg(feature = "blocking")]
43pub mod blocking_shell;
44
45#[cfg(feature = "hosts-fetcher")]
46pub mod hosts_fetcher;
47
48// Re-export core types and session machinery so consumers don't
49// need a separate `dstar-gateway-core` dependency.
50pub use dstar_gateway_core::{
51    AMBE_SILENCE, BandLetter, Callsign, DSTAR_SYNC_BYTES, DStarHeader, Error, HostEntry, HostFile,
52    Module, ProtocolKind, ReflectorCallsign, StreamId, Suffix, TypeError, VoiceFrame,
53};
54
55#[cfg(test)]
56use pcap_parser as _;
57#[cfg(test)]
58use tracing_subscriber as _;
59#[cfg(test)]
60use trybuild as _;