Crate ns_env_config [] [src]

The name resolution configured via environment variable.

API Docs | Usage | Github | Crate

This crate also re-exports important things from abstract-ns and router so that you don't have to track too many dependencies.

Example

extern crate ns_env_config;
extern crate tokio_core;
use tokio_core::reactor::Core;

fn main() {
    let mut core = Core::new().expect("reactor init");
    let ns = ns_env_config::init(&core.handle()).expect("name system init");
    let addr = core.run(ns.resolve_auto("localhost", 80)).unwrap();
    println!("Localhost HTTP is {:?}", addr);
}

Reexports

pub extern crate abstract_ns as ns;
pub extern crate ns_router as router;

Modules

config

Structures which describe configuration

Structs

Address

Address that nameservice has returned

IpList

IpList is a wrapper type around Vec<IpAddr> which serves the same role as the Address but for resolving hostnames (or A records) instead of services (i.e. host:port pairs or SRV records)

Router

An actual router class

Enums

Error

A generic name resolution error

Functions

force_config

Init resolver with specified config, ignoring environment

init

Init resolver on he specified main loop by parsing environment

init_default

Init resolver by parsing environment while overriding default