Struct domain::resolv::conf::ResolvConf[][src]

pub struct ResolvConf {
    pub servers: Vec<ServerConf>,
    pub search: Vec<DNameBuf>,
    pub ndots: usize,
    pub timeout: Duration,
    pub attempts: usize,
    pub options: ResolvOptions,
    pub idle_timeout: Duration,
}

Resolver configuration.

This type collects all information necessary to configure how a stub resolver talks to its upstream resolvers.

The type follows the builder pattern. After creating a value with ResolvConf::new() you can manipulate the members. Once you are happy with them, you call finalize() to make sure the configuration is valid. It mostly just fixes the servers.

Additionally, the type can parse a glibc-style configuration file, commonly known as /etc/resolv.conf through the parse() and parse_file() methods. You still need to call finalize() after parsing.

The easiest way, however, to get the system resolver configuration is through ResolvConf::default(). This will parse the configuration file or return a default configuration if that fails.

Fields

Addresses of servers to query.

Search list for host-name lookup.

TODO Sortlist sortlist: ?? Number of dots before an initial absolute query is made.

Timeout to wait for a response.

Number of retries before giving up.

Default options.

Default idle timeout for stream oriented transports.

Methods

impl ResolvConf
[src]

Creates a new, empty configuration.

Using an empty configuration will fail since it does not contain any name servers. Call self.finalize() to make it usable.

Finalizes the configuration for actual use.

The function does two things. If servers is empty, it adds 127.0.0.1:53. This is exactly what glibc does. If search is empty, it adds the root domain ".". This differs from what glibc does which considers the machine’s host name.

Creates a default configuration for this system.

XXX This currently only works for Unix-y systems.

impl ResolvConf
[src]

Parses the configuration from a file.

Parses the configuration from a reader.

The format is that of the /etc/resolv.conf file.

Trait Implementations

impl Clone for ResolvConf
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ResolvConf
[src]

Formats the value using the given formatter. Read more

impl Default for ResolvConf
[src]

Returns the "default value" for a type. Read more

impl Display for ResolvConf
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for ResolvConf

impl Sync for ResolvConf