mdns-resolver

Crates.iomdns-resolver
lib.rsmdns-resolver
version0.1.0
sourcesrc
created_at2021-08-25 23:35:57.413027
updated_at2021-08-25 23:35:57.413027
descriptionA simple async legacy mDNS resolver
homepage
repository
max_upload_size
id442394
size33,575
Tim Buckley (timothyb89)

documentation

README

mdns-resolver

A simple mDNS resolver derived from simple-mdns, in async Rust with no native dependencies.

What is this?

This crate performs local DNS lookups in a similar fashion as avahi-resolve -n; in other words, it translates Bonjour-style hostnames (e.g. foo.local) to an IP address.

Most resolvers (including simple-mdns) are intended to browse or query services by type rather than name. This crate is intended to reliably discover the IP for a given hostname in the same fashion that a desktop device with Avahi or another similar local resolver would resolve hosts under the virtual .local domain.

It's derived from simple_mdns::OneShotMdnsResolver with a few key differences:

  • Uses async rather than blocking Rust
  • Rewritten packet processing handles an arbitrary number of concurrent queries
  • Listens on the correct interface for query replies

This library was developed for use in the homedns DNS server, which translates regular DNS queries into mDNS for clients that don't (or can't) support mDNS lookups on their own (such as Docker containers, pre-baked IoT appliances, etc).

Usage

The included example utility mdns-query can be used to lookup a single hostname:

$ cargo run -q --features=bins --bin mdns-query linux.local
linux.local = 192.168.10.104

Take a look at mdns-query.rs for a simple library usage example. It should handle concurrent requests just fine, and MdnsQuery is Clone for multithreaded use.

Commit count: 0

cargo fmt