mctx-core
mctx-core is a runtime-agnostic multicast sender library for IPv4 and IPv6
ASM/SSM-style traffic.
The default API focuses on lightweight UDP multicast send with explicit socket ownership, deterministic source/interface control, and non-blocking operation. Optional features add Tokio integration, metrics, raw IP datagram transmit, and Python bindings without changing the default UDP send path.
Highlights
- IPv4 and IPv6 multicast send support
- Explicit separation between sender source address and outgoing interface
- Exact IPv4 or IPv6 local bind control for announce-style senders
- Predictable IPv6 destination scope handling for
ff31/ff32vsff35/ff38/ff3e - Non-blocking send API with caller-owned context and socket extraction
- Caller-provided socket support
- Optional
tokio,metrics, andraw-packetsfeatures - Optional Python bindings in the sibling
mctx-core-pycrate
Install
Optional feature examples:
Python bindings are available in
mctx-core-py.
Quick Start
use ;
use Ipv4Addr;
let mut ctx = new;
let id = ctx.add_publication?;
let report = ctx.send?;
println!;
println!;
For IPv6 examples, source/interface rules, and CLI commands, see IPv6 Multicast and Demo Binaries.
Feature Map
tokio: async send wrapper for extracted publications.metrics: snapshots, deltas, samplers, and Heimdall-style JSONL helpers.raw-packets: complete multicast IP datagram transmit for AMT-style use cases.mctx-core-py: sibling workspace crate with Python and asyncio bindings.
Documentation
- Usage Guide: core Rust sender API flow.
- IPv6 Multicast: source vs interface, scopes, and SSM group rules.
- Raw Packet Transmit:
raw-packetsAPI and platform limits. - Demo Binaries: sender CLI commands and metrics examples.
- Metrics: snapshot, delta, and JSONL semantics.
- Python Bindings: Python API and asyncio helper.
- Architecture: main types and module layout.
- Design Decisions: why the API is shaped this way.
Platform Support
| OS | IPv4 send | IPv6 ASM send | IPv6 SSM-style send | Notes |
|---|---|---|---|---|
| macOS | ✅ | ✅ | ✅ | ff32::/16 should use a fe80:: source |
| Linux | ✅ | ✅ | ✅ | intended support |
| Windows | ✅ | ✅ | ✅ | keep scope ID only for ff31 / ff32 |
The default UDP send path supports IPv4 and IPv6 multicast on the same platforms.
Raw multicast IP datagram transmit is available behind the raw-packets
feature. Linux and macOS support raw IPv4 and IPv6 transmit. Windows currently
supports raw IPv4 transmit only. On Linux and macOS IPv6, the source/group
tuple and transport header are preserved, while the kernel rebuilds the base
IPv6 header during raw transmit.
License
BSD 2-Clause