rtciv0.5.0

rtci-mdns

Sans-I/O mDNS (RFC 6762) querier and responder, as used for WebRTC mDNS ICE candidates. 1 public module, 13 items at 0.5.0.

README

Multicast DNS for WebRTC: a querier that resolves .local names (the mDNS host candidates browsers send) and a responder that publishes local names, with probing, announcing, answering, defending a name and goodbyes, a cache bounded by TTL, and one rate limit over everything sent.

Specifications

  • RFC 6762, Multicast DNS
  • draft-ietf-mmusic-mdns-ice-candidates, mDNS names for ICE host candidates

Clause-by-clause status, with the test that proves each clause: rfc6762, draft-ietf-mmusic-mdns-ice-candidates.

Use

Mdns::new(now, MdnsConfig) creates the state machine; query_now starts a query and poll_event reports the answer (MdnsEvent). MulticastSocket builds a UDP socket joined to the mDNS group for applications that want one. The root crate (rtci) uses it for mDNS candidates. The crate documentation has query and responder examples.

MulticastSocket::with_interface joins and sends on that interface (IP_MULTICAST_IF, RFC 6762 section 14). Without one the socket joins on INADDR_ANY and sends by the system's route for 224.0.0.251, except on Windows, where it joins and sends on the default route's interface: there the group's route comes from a destination cache that any process which sent to the group from 127.0.0.1 leaves on loopback for the whole host. A Windows host whose mDNS link is not the default route's should pass the interface.

Sans-I/O

The protocol is a sansio::Protocol: datagrams in through handle_read, out through poll_write, deadlines through poll_timeout / handle_timeout. Only MulticastSocket, an optional helper, touches the operating system. The crate does no I/O and reads no clock: every call that depends on time takes an Instant from the caller.

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_mdns

A sans-I/O implementation of mDNS (Multicast DNS) for Rust.

  • structMdnsfrom proto::MdnsSans-I/O mDNS Connection.
  • structMdnsConfigfrom config::MdnsConfigMdnsConfiguration for an mDNS connection.
  • structMulticastSocketfrom socket::MulticastSocketA builder for creating multicast UDP sockets suitable for mDNS.
  • enumMdnsEventfrom proto::MdnsEventEvents emitted by the mDNS connection.
  • enumMdnsProbePolicyfrom config::MdnsProbePolicyWhether a name is probed for (RFC 6762 section 8.1) before it is announced and answered.
  • typeQueryIdfrom proto::QueryIdUnique identifier for tracking mDNS queries.
  • constMAX_CACHED_ADDRESSESfrom proto::MAX_CACHED_ADDRESSESThe most addresses the resolver's cache holds. Any host on the link can offer records, so the cache is bounded: when it is full, the entry nearest its expiry gives way to one that lives longer.
  • constMAX_LOCAL_NAMESfrom proto::MAX_LOCAL_NAMESThe most names Mdns::add_local_name registers: one per local address is the use, and a host has a handful.
  • constMDNS_DEST_ADDRfrom proto::MDNS_DEST_ADDRmDNS multicast destination address (224.0.0.251:5353).
  • constMDNS_MULTICAST_IPV4from proto::MDNS_MULTICAST_IPV4The mDNS multicast group address (224.0.0.251).
  • constMDNS_PORTfrom proto::MDNS_PORTThe standard mDNS port (5353).
  • useifacesfrom shared::ifaces
  • useMdnsRateLimitfrom proto::MdnsRateLimitA limit on the mDNS messages sent, as a token bucket: burst messages may leave back to back, after which per_second leave each second.

Generated from the sources of rtci-mdns 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.