Abstract-ns v0.4.0, all you need to know about name resolution and DNS in rust


I've just released a new, much-redesigned version abstract-ns a library that helps with name resolution.

The goal is to make a standard name resolution for rust and futures (including, but presumably not limited to tokio), the name resolution that:

  1. Adapts to name changes
  2. Supports multiple sources
  3. Works with today systems too

This is name resolution more in the sense of name discovery rather than resolving arbitrary DNS queries (i.e. reverse queries or DKIM are out of scope, on the other hand, non-DNS-based resolution is encouraged, see below).

The abstract part contains mostly traits, and there are more parts of the ecosystem:

  • ns-std-threaded a name resolver that uses libc in thread, ugly but the most compatible library
  • ns-dns-tokio a name resolver that uses domain library
  • ns-router the thing that allows configuring different suffixes to use different resolvers, allows dynamic configuration and optimizes some things, this is an entry point for end-user apps
  • tk-listen allows to bind to whatever IP name resolves easily, and to rebind if name changes (latter is mostly for config changes)
  • tk-pool a connection pool that potentially connects to all addresses resolved and adapts to name changes

We try to keep parts as much decoupled as possible. I.e. tk-listen actually relies on Stream<Vec<SocketAddr>> not anything from abstract-ns, tk-pool needs a Stream<Address> so it depends on address structure but nothing else. Also, a pool is just a Sink so works for any kinds of request-reply or push-style protocols.

What is in to do list:

  • tk-pool has some issues, and also needs to gain more strategies, here is some inspiration
  • a lightweight DNS library on TCP using tk-pool and dns-parser. As long as your resolver on localhost or LAN it should be good enough and support SRV (and you can fallback to sophisticated resolver only when needed)

Where the help is needed:

  • probably an implementation based on trust-dns
  • mDNS-based resolution if someone finds it useful
  • non-DNS-based implementations, especially ones supporting updates:
    • consul (esp. via HTTP with subscriptions)
    • eureka
    • etcd or zookeeper (?)
  • more tools and protocols supporting name resolution this way
  • maybe ns-config-toml that creates ns-router configuration from toml so that this type of configuration can be reused across applications?

Any thoughts?