Crate cdns_rs[][src]

Expand description

cdns-rs

An implementation of client side DNS query library - a resolver, a set of routines that provide access to the Internet Domain Name System (DNS).

This library provides both: sync and async crates to query remote DNS servers and local hosts file.

This code will be considered stable only when the major part of verion number will reach v 1.x.x

Limitations

  • This library reads /etc/hosts and partially understands /etc/resolv.conf i.e only ‘nameserver’ option is parsed at the moment.
  • This library does not support TCP query at the moment.
  • The nsswitch.conf is also ignored as this crate at the moment is not pretending to be a glibc/libc replacement.
  • Does not support DNS-over-TLS at the moment
  • Does not support DNSSEC at the moment
  • /etc/resolve.conf is limited to ‘nameserver’

Supports

Supported GNU/Linux and *BSD (incl OSX, but not guaranteed)

Layout

Dirs:

  • a_sync - contains all async code
  • sync - contains all sync code Files:
  • portable.rs - contains the code which requres porting to other OS. This code usually incompatiable with different UNIX-type OSes.
  • tokenizer.rs - contains simple tokenizer for parsing config files.
  • caches.rs - contains a cached in memory config files like /etc/hosts. If file was modified, the cache controller attempts to reload file during library call from main program.
  • cfg_parsers.rs - contains the confgiration files parsers.
  • common.rs - this file contains all code related to DNS protocol i.e structures, parsing.
  • mutex.rs - a local implementaion of mutex for dafu usage in multithreading env. Derived from rust’s mutex implementation.
  • network.rs - a code which deals with networking part, i.e msg exchange with DNS server.
  • poison.rs - a mutex poison detection derived from rust’s code.
  • query.rs - file contains a code which combines common.rs, networking.rs and cache managment. Also convers raw result to a structured data tables.
  • shortcuts.rs - a code for faster prototyping i.e MX records requests or A or AAAA.
  • error.rs - an error wrapper and mapper

Features:

  • feature = “use_async” for asynchronious code (use cdns_rs::a_sync::{…};)
  • feature = “use_sync” for synchronious code (use cdns_rs::sync::{…};)
  • feature = “stderr_output” to enable output of soft errors to stderr

All features can be used simultaniously.

Usage

cdns-rs = {version = “0.1”, default-features = false, features = [“use_sync”]}

By default, both use_async and use_sync features are enabled.

Modules

Macros

Traits

Support trait for enabling a few common operation on lazy static values.

Used for immutable dereferencing operations, like *v.

Functions

Takes a shared reference to a lazy static and initializes it if it has not been already.