#mdns #dns-sd #zeroconf #sansio #dns-server #networking

no-std agnostic-mdns

Sans-I/O style simple and lightweight mDNS client/server library for any async runtime

3 releases (breaking)

0.3.0 Jan 30, 2025
0.2.0 Jan 29, 2025
0.1.1 Jan 11, 2025
0.1.0 Jan 11, 2025

#856 in Network programming

Download history 223/week @ 2025-01-08 29/week @ 2025-01-15 276/week @ 2025-01-29

528 downloads per month

MIT/Apache

150KB
3.5K SLoC

Agnostic mDNS

Sans-I/O style simple and lightweight mDNS client/server library for any async runtime.

Port HashiCorp's mdns to Rust.

github LoC Build codecov

docs.rs crates.io crates.io license

Introduction

Sans-I/O style simple and lightweight mDNS client/server library for any async runtime. mDNS or Multicast DNS can be used to discover services on the local network without the use of an authoritative DNS server. This enables peer-to-peer discovery. It is important to note that many networks restrict the use of multicasting, which prevents mDNS from functioning. Notably, multicast cannot be used in any sort of cloud, or shared infrastructure environment. However it works well in most office, home, or private infrastructure environments.

Installation

  • tokio

    [dependencies]
    agnostic-mdns = { version = "0.3", features = ["tokio"] }
    
  • async-std

    [dependencies]
    agnostic-mdns = { version = "0.3", features = ["async-std"] }
    
  • smol

    [dependencies]
    agnostic-mdns = { version = "0.3", features = ["smol"] }
    

Examples

Please see examples.

Pedigree

  • This mdns code is port from HashiCorp's mdns implementation.

  • The DNS message encoding/decoding is inspired by miekg's dns implementation.

License

agnostic-mdns is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Dependencies

~10–39MB
~602K SLoC