Implements WS_RELAY_SPEC.md: relay handles both QUIC and WebSocket clients
in shared rooms, eliminating the wzp-web bridge server.
Room abstraction (room.rs):
- New ParticipantSender enum: Quic(transport) | WebSocket(mpsc::Sender)
- send_raw() sends PCM bytes to either transport type
- join_ws() convenience method for WS clients
- Forwarding loops handle mixed QUIC+WS rooms:
QUIC→QUIC: send_media (trunked if enabled)
QUIC→WS: send_raw payload bytes
WS→QUIC: send_raw wraps in MediaPacket
WS→WS: send_raw binary
WebSocket handler (ws.rs):
- GET /ws/{room} → WebSocket upgrade via axum
- Auth: first msg {"type":"auth","token":"..."} → validates against FC
- mpsc channel bridges room fan-out to WS binary frames
- Session + presence lifecycle matches QUIC path
- Optional static file serving via --static-dir (tower-http ServeDir)
Config: --ws-port 8080, --static-dir ./static
Proto: MediaHeader::default_pcm() for WS→QUIC wrapping
63 relay + 54 proto tests passing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
831 B
Rust
29 lines
831 B
Rust
//! WarzonePhone Relay Daemon
|
|
//!
|
|
//! Integration crate that wires together all layers into a relay pipeline:
|
|
//! recv → FEC decode → jitter buffer → FEC encode → send
|
|
//!
|
|
//! The relay forwards media between two QUIC endpoints without decoding audio.
|
|
//! It operates on FEC-protected packets, managing loss recovery and adaptive
|
|
//! quality transitions.
|
|
|
|
pub mod auth;
|
|
pub mod config;
|
|
pub mod handshake;
|
|
pub mod metrics;
|
|
pub mod pipeline;
|
|
pub mod presence;
|
|
pub mod probe;
|
|
pub mod relay_link;
|
|
pub mod room;
|
|
pub mod route;
|
|
pub mod session_mgr;
|
|
pub mod trunk;
|
|
pub mod ws;
|
|
|
|
pub use config::RelayConfig;
|
|
pub use handshake::accept_handshake;
|
|
pub use pipeline::{PipelineConfig, PipelineStats, RelayPipeline};
|
|
pub use session_mgr::{RelaySession, SessionId, SessionInfo, SessionManager, SessionState};
|
|
pub use trunk::TrunkBatcher;
|