Skip to content

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-webrtc

Layers ​

LayerCratesRule
Formats and wirejanus-config, janus-json, janus-sdp, janus-rtp, janus-sctp, janus-recordPure functions over bytes or text. Ports of one C file each, with the C line numbers in the comments.
Crypto and media state machinesjanus-crypto, janus-srtp, janus-dtls, janus-ice, janus-webrtc, janus-media, janus-opus, janus-rtpfwdNo sockets inside. The binary feeds them packets and sends what they return.
Corejanus-coreSessions, handles, both APIs, authentication, logging, startup. Defines the Plugin, Transport, EventHandler and Logger traits.
Extensionsplugins/*, transports/*, eventhandlers/*, loggers/*One crate each. Plugins implement Plugin; they never touch a socket.
BinaryjanusReads the config, builds the core, owns every socket, starts the listeners.
Dev toolsxtask, 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 ​

PathPackageWhat it holds
crates/janus-configjanus-config.jcfg (libconfig syntax) + legacy .cfg INI parser/writer; port of src/config.c
crates/janus-corejanus-coreSessions/handles/refcount semantics, Janus API + Admin API, auth, event loops, logging, plugin/transport/evh/logger traits + registry, CLI
crates/janus-cryptojanus-cryptoRustCrypto glue: AES-CM/GCM, HMAC-SHA1, P-256 ECDHE/ECDSA, X.509 self-signed cert gen, fingerprints
crates/janus-dtlsjanus-dtlsDTLS 1.2 via dimpl (RustCrypto backend), SRTP key export (RFC 5764), role/setup handling, retransmission timers
crates/janus-icejanus-iceSans-IO full ICE + ICE-lite, STUN (RFC 5389/8489), TURN client, ICE-TCP, mDNS, consent freshness, nat_1_1, TURN REST
crates/janus-jsonjanus-jsonJanus API envelopes, error codes (apierror.h), event types (events.h); serde_json with preserve_order
crates/janus-mediajanus-mediaPure-Rust codecs/DSP: Opus wrapper, G.711, G.722, resampler, jitter buffer, limiter, RNNoise, Ogg, WAV
crates/janus-opusjanus-opusOpus codec through libopus bindings (audiopus). The C reference is the decoder and encoder; ADR-0007
crates/janus-recordjanus-record.mjr writer/reader (port of record.c), byte-compatible
crates/janus-rtpjanus-rtpPort of rtp.c/rtcp.c: header/ext parse+write, extmaps, seq/ts rewrite, simulcast/SVC contexts, RTCP packets
crates/janus-rtpfwdjanus-rtpfwdPort of rtpfwd.c: RTP/RTCP forwarders, SRTP forwarding, multicast
crates/janus-script-jsjanus-script-jsBoa (pure-Rust JS) integration replacing Duktape, with Duktape-compat shims
crates/janus-script-luajanus-script-luaLua VM integration (gate G5), exact port of the janus_lua_extra.c API
crates/janus-sctpjanus-sctpSCTP over DTLS + DCEP data channels (text/binary, labels, protocols, ordered/unordered)
crates/janus-sdpjanus-sdpPort of sdp-utils.c + sdp.c: parser/serializer preserving Janus quirks, offer/answer merge, codec PT mapping
crates/janus-sip-stackjanus-sip-stackSIP UA layer on chosen pure-Rust stack (gate G4)
crates/janus-srtpjanus-srtpSRTP/SRTCP: AES_CM_128_HMAC_SHA1_80/32, AEAD_AES_128_GCM/256_GCM, ROC, replay; SDES-SRTP support
crates/janus-tlsjanus-tlsTLS 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-webrtcjanus-webrtcPeerConnection orchestration replicating ice.c: NACK queue, RTX, TWCC, REMB, slow_link, no-media timer, stats, pcap dumps
plugins/audiobridgejanus-plugin-audiobridgeAudioBridge plugin: mixing, resampling, spatial audio, announcements, plain-RTP (port of src/plugins/janus_audiobridge.c)
plugins/duktapejanus-plugin-duktapeDuktape-compatible JS plugin on Boa, exact port of janus_duktape_extra.c API
plugins/echotestjanus-plugin-echotestEchoTest plugin: echo back audio/video (port of src/plugins/janus_echotest.c)
plugins/luajanus-plugin-luaLua scripting plugin shell (janus_lua.c port) with the Lua engine behind a trait; engine choice pending gate G5
plugins/nosipjanus-plugin-nosipNoSIP plugin: SDP to plain RTP/SDES-SRTP bridging (port of src/plugins/janus_nosip.c)
plugins/recordplayjanus-plugin-recordplayRecordPlay plugin: record/playback with .mjr (port of src/plugins/janus_recordplay.c)
plugins/sipjanus-plugin-sipSIP plugin: register/call/transfer/DTMF, SDES-SRTP, sip-gateway mode (port of src/plugins/janus_sip.c)
plugins/streamingjanus-plugin-streamingStreaming plugin: RTP/SRTP/multicast/RTSP/file sources, mountpoints (port of src/plugins/janus_streaming.c)
plugins/textroomjanus-plugin-textroomTextRoom plugin: data-channel text rooms + HTTP forwarding (port of src/plugins/janus_textroom.c)
plugins/videocalljanus-plugin-videocallVideoCall plugin: 1:1 calls, registration, forwarding (port of src/plugins/janus_videocall.c)
plugins/videoroomjanus-plugin-videoroomVideoRoom plugin: rooms, publishers/subscribers, simulcast/SVC, remote publishers, moderation (port of src/plugins/janus_videoroom.c)
transports/httpjanus-transport-httpHTTP transport: long-poll, CORS, admin port, IPv6, interface binding (port of src/transports/janus_http.c)
transports/mqttjanus-transport-mqttMQTT transport v3.1.1/v5 with admin topics (port of src/transports/janus_mqtt.c)
transports/nanomsgjanus-transport-nanomsgNanomsg transport over in-house SP protocol (port of src/transports/janus_nanomsg.c)
transports/pfunixjanus-transport-pfunixUnix domain sockets transport SEQPACKET/DGRAM (port of src/transports/janus_pfunix.c)
transports/rabbitmqjanus-transport-rabbitmqRabbitMQ transport: queues, exchanges, admin (port of src/transports/janus_rabbitmq.c)
transports/websocketsjanus-transport-websocketsWebSockets transport: protocols janus-protocol / janus-admin-protocol, ping/pong, ACL (port of src/transports/janus_websockets.c)
eventhandlers/gelfjanus-evh-gelfGELF event handler: UDP chunking/TCP, compression (port of src/events/janus_gelfevh.c)
eventhandlers/mqttjanus-evh-mqttMQTT event handler (port of src/events/janus_mqttevh.c)
eventhandlers/nanomsgjanus-evh-nanomsgNanomsg event handler (port of src/events/janus_nanomsgevh.c)
eventhandlers/rabbitmqjanus-evh-rabbitmqRabbitMQ event handler (port of src/events/janus_rabbitmqevh.c)
eventhandlers/samplejanus-evh-sampleSample HTTP event handler: grouping, auth, retries, compression (port of src/events/janus_sampleevh.c)
eventhandlers/wsjanus-evh-wsWebSockets event handler (port of src/events/janus_wsevh.c)
loggers/jsonlogjanus-logger-jsonlogJSON file logger (port of src/loggers/janus_jsonlog.c)
tools/janus-cfgconvjanus-cfgconvConvert legacy .cfg INI configs to .jcfg (port of src/janus-cfgconv.c)
tools/janus-pp-recjanus-pp-recPost-processing recorder: .mjr to opus/ogg/webm/mka/mp4/wav/srt (port of src/postprocessing/recorder.c)
tools/mjr2pcapmjr2pcapConvert .mjr recordings to pcap (port of src/postprocessing/mjr2pcap.c)
tools/pcap2mjrpcap2mjrConvert pcap captures to .mjr (port of src/postprocessing/pcap2mjr.c)
janusjanusJanus WebRTC gateway, 100% Rust rewrite (server binary)
xtaskxtaskjanus-rs task runner: purity check, parity matrix generation
parityjanus-parityDifferential 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 handledcrates/janus-core/src/api.rs and admin.rs
Change an HTTP or WebSocket behaviourjanus/src/http_listener.rs, janus/src/ws_listener.rs, and the transport crates in transports/
Add or fix a plugin requestplugins/<name>/src/lib.rs: its header lists what is not ported
Debug ICE or DTLScrates/janus-ice/src/agent.rs, crates/janus-dtls, janus/src/ice_socket.rs
Read or write configcrates/janus-config, crates/janus-core/src/startup_config.rs
See what the C server doesthe 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.

GPL-3.0-or-later, like the Janus gateway it ports.