Crate map
The repository is one Cargo workspace. Small crates do one job each, mirroring a file or a family of files of the C server. Plugins, transports, event handlers and tools are crates of their own, and the janus binary wires them together.
text
┌──────────────────────── janus (binary) ───────────────────────┐
HTTP, WebSockets, │ listeners: http_listener, ws_listener, pfunix, mqtt, ... │
MQTT, AMQP, UDS ───▶ │ │ │
│ ▼ │
│ janus-core: sessions, handles, Janus API, Admin API, auth, │
│ event loops, plugin / transport / event-handler traits │
│ │ ▲ │
│ ▼ │ events, relays │
│ plugins/* (echotest, videoroom, streaming, sip, ...) │
└────────┬───────────────────────────────────────────────────────┘
▼
media plane (sans-IO state machines, driven by the binary's UDP sockets):
janus-ice → janus-dtls → janus-srtp → janus-rtp / janus-sctp ← janus-sdp, janus-webrtcLayers
| Layer | Crates | Rule |
|---|---|---|
| Formats and wire | janus-config, janus-json, janus-sdp, janus-rtp, janus-sctp, janus-record | Pure functions over bytes or text. Ports of one C file each, with the C line numbers in the comments. |
| Crypto and media state machines | janus-crypto, janus-srtp, janus-dtls, janus-ice, janus-webrtc, janus-media, janus-opus, janus-rtpfwd | No sockets inside. The binary feeds them packets and sends what they return. |
| Core | janus-core | Sessions, handles, both APIs, authentication, logging, startup. Defines the Plugin, Transport, EventHandler and Logger traits. |
| Extensions | plugins/*, transports/*, eventhandlers/*, loggers/* | One crate each. Plugins implement Plugin; they never touch a socket. |
| Binary | janus | Reads the config, builds the core, owns every socket, starts the listeners. |
| Dev tools | xtask, parity, tools/* | xtask is the task runner (purity, parity, capture, progress); parity is the harness library; tools/* are the command-line tools. |
Plugins are compiled in behind Cargo features instead of loaded as .so files, which is the one structural break with the C server (coming from C).
Every workspace member
| Path | Package | What it holds |
|---|---|---|
crates/janus-config | janus-config | .jcfg (libconfig syntax) + legacy .cfg INI parser/writer; port of src/config.c |
crates/janus-core | janus-core | Sessions/handles/refcount semantics, Janus API + Admin API, auth, event loops, logging, plugin/transport/evh/logger traits + registry, CLI |
crates/janus-crypto | janus-crypto | RustCrypto glue: AES-CM/GCM, HMAC-SHA1, P-256 ECDHE/ECDSA, X.509 self-signed cert gen, fingerprints |
crates/janus-dtls | janus-dtls | DTLS 1.2 via dimpl (RustCrypto backend), SRTP key export (RFC 5764), role/setup handling, retransmission timers |
crates/janus-ice | janus-ice | Sans-IO full ICE + ICE-lite, STUN (RFC 5389/8489), TURN client, ICE-TCP, mDNS, consent freshness, nat_1_1, TURN REST |
crates/janus-json | janus-json | Janus API envelopes, error codes (apierror.h), event types (events.h); serde_json with preserve_order |
crates/janus-media | janus-media | Pure-Rust codecs/DSP: Opus wrapper, G.711, G.722, resampler, jitter buffer, limiter, RNNoise, Ogg, WAV |
crates/janus-opus | janus-opus | Opus codec through libopus bindings (audiopus). The C reference is the decoder and encoder; ADR-0007 |
crates/janus-record | janus-record | .mjr writer/reader (port of record.c), byte-compatible |
crates/janus-rtp | janus-rtp | Port of rtp.c/rtcp.c: header/ext parse+write, extmaps, seq/ts rewrite, simulcast/SVC contexts, RTCP packets |
crates/janus-rtpfwd | janus-rtpfwd | Port of rtpfwd.c: RTP/RTCP forwarders, SRTP forwarding, multicast |
crates/janus-script-js | janus-script-js | Boa (pure-Rust JS) integration replacing Duktape, with Duktape-compat shims |
crates/janus-script-lua | janus-script-lua | Lua VM integration (gate G5), exact port of the janus_lua_extra.c API |
crates/janus-sctp | janus-sctp | SCTP over DTLS + DCEP data channels (text/binary, labels, protocols, ordered/unordered) |
crates/janus-sdp | janus-sdp | Port of sdp-utils.c + sdp.c: parser/serializer preserving Janus quirks, offer/answer merge, codec PT mapping |
crates/janus-sip-stack | janus-sip-stack | SIP UA layer on chosen pure-Rust stack (gate G4) |
crates/janus-srtp | janus-srtp | SRTP/SRTCP: AES_CM_128_HMAC_SHA1_80/32, AEAD_AES_128_GCM/256_GCM, ROC, replay; SDES-SRTP support |
crates/janus-tls | janus-tls | TLS for the transports and event handlers: rustls on the pure-Rust graviola provider, PEM and encrypted-key loading, OpenSSL and GnuTLS cipher strings (ADR-0009) |
crates/janus-webrtc | janus-webrtc | PeerConnection orchestration replicating ice.c: NACK queue, RTX, TWCC, REMB, slow_link, no-media timer, stats, pcap dumps |
plugins/audiobridge | janus-plugin-audiobridge | AudioBridge plugin: mixing, resampling, spatial audio, announcements, plain-RTP (port of src/plugins/janus_audiobridge.c) |
plugins/duktape | janus-plugin-duktape | Duktape-compatible JS plugin on Boa, exact port of janus_duktape_extra.c API |
plugins/echotest | janus-plugin-echotest | EchoTest plugin: echo back audio/video (port of src/plugins/janus_echotest.c) |
plugins/lua | janus-plugin-lua | Lua scripting plugin shell (janus_lua.c port) with the Lua engine behind a trait; engine choice pending gate G5 |
plugins/nosip | janus-plugin-nosip | NoSIP plugin: SDP to plain RTP/SDES-SRTP bridging (port of src/plugins/janus_nosip.c) |
plugins/recordplay | janus-plugin-recordplay | RecordPlay plugin: record/playback with .mjr (port of src/plugins/janus_recordplay.c) |
plugins/sip | janus-plugin-sip | SIP plugin: register/call/transfer/DTMF, SDES-SRTP, sip-gateway mode (port of src/plugins/janus_sip.c) |
plugins/streaming | janus-plugin-streaming | Streaming plugin: RTP/SRTP/multicast/RTSP/file sources, mountpoints (port of src/plugins/janus_streaming.c) |
plugins/textroom | janus-plugin-textroom | TextRoom plugin: data-channel text rooms + HTTP forwarding (port of src/plugins/janus_textroom.c) |
plugins/videocall | janus-plugin-videocall | VideoCall plugin: 1:1 calls, registration, forwarding (port of src/plugins/janus_videocall.c) |
plugins/videoroom | janus-plugin-videoroom | VideoRoom plugin: rooms, publishers/subscribers, simulcast/SVC, remote publishers, moderation (port of src/plugins/janus_videoroom.c) |
transports/http | janus-transport-http | HTTP transport: long-poll, CORS, admin port, IPv6, interface binding (port of src/transports/janus_http.c) |
transports/mqtt | janus-transport-mqtt | MQTT transport v3.1.1/v5 with admin topics (port of src/transports/janus_mqtt.c) |
transports/nanomsg | janus-transport-nanomsg | Nanomsg transport over in-house SP protocol (port of src/transports/janus_nanomsg.c) |
transports/pfunix | janus-transport-pfunix | Unix domain sockets transport SEQPACKET/DGRAM (port of src/transports/janus_pfunix.c) |
transports/rabbitmq | janus-transport-rabbitmq | RabbitMQ transport: queues, exchanges, admin (port of src/transports/janus_rabbitmq.c) |
transports/websockets | janus-transport-websockets | WebSockets transport: protocols janus-protocol / janus-admin-protocol, ping/pong, ACL (port of src/transports/janus_websockets.c) |
eventhandlers/gelf | janus-evh-gelf | GELF event handler: UDP chunking/TCP, compression (port of src/events/janus_gelfevh.c) |
eventhandlers/mqtt | janus-evh-mqtt | MQTT event handler (port of src/events/janus_mqttevh.c) |
eventhandlers/nanomsg | janus-evh-nanomsg | Nanomsg event handler (port of src/events/janus_nanomsgevh.c) |
eventhandlers/rabbitmq | janus-evh-rabbitmq | RabbitMQ event handler (port of src/events/janus_rabbitmqevh.c) |
eventhandlers/sample | janus-evh-sample | Sample HTTP event handler: grouping, auth, retries, compression (port of src/events/janus_sampleevh.c) |
eventhandlers/ws | janus-evh-ws | WebSockets event handler (port of src/events/janus_wsevh.c) |
loggers/jsonlog | janus-logger-jsonlog | JSON file logger (port of src/loggers/janus_jsonlog.c) |
tools/janus-cfgconv | janus-cfgconv | Convert legacy .cfg INI configs to .jcfg (port of src/janus-cfgconv.c) |
tools/janus-pp-rec | janus-pp-rec | Post-processing recorder: .mjr to opus/ogg/webm/mka/mp4/wav/srt (port of src/postprocessing/recorder.c) |
tools/mjr2pcap | mjr2pcap | Convert .mjr recordings to pcap (port of src/postprocessing/mjr2pcap.c) |
tools/pcap2mjr | pcap2mjr | Convert pcap captures to .mjr (port of src/postprocessing/pcap2mjr.c) |
janus | janus | Janus WebRTC gateway, 100% Rust rewrite (server binary) |
xtask | xtask | janus-rs task runner: purity check, parity matrix generation |
parity | janus-parity | Differential parity harness: replays golden traces against C oracle and janus-rs, diffs normalised transcripts |
Where to look first
| You want to... | Start here |
|---|---|
| Change how a Janus API request is handled | crates/janus-core/src/api.rs and admin.rs |
| Change an HTTP or WebSocket behaviour | janus/src/http_listener.rs, janus/src/ws_listener.rs, and the transport crates in transports/ |
| Add or fix a plugin request | plugins/<name>/src/lib.rs: its header lists what is not ported |
| Debug ICE or DTLS | crates/janus-ice/src/agent.rs, crates/janus-dtls, janus/src/ice_socket.rs |
| Read or write config | crates/janus-config, crates/janus-core/src/startup_config.rs |
| See what the C server does | the file named in the comment above the Rust code, in ../januscaler-janus-gateway |
The crate-by-crate design is in PLAN.md section 1, and the working rules are in AGENTS.md.