pub struct ResolvConf {
pub servers: Vec<ServerConf>,
pub options: ResolvOptions,
}
Expand description
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::system_default()
. This will parse the configuration
file or return a default configuration if that fails.
Fields§
§servers: Vec<ServerConf>
Addresses of servers to query.
options: ResolvOptions
Default options.
Implementations§
source§impl ResolvConf
impl ResolvConf
§Management
sourcepub fn new() -> Self
pub fn new() -> Self
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.
sourcepub fn finalize(&mut self)
pub fn finalize(&mut self)
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.
source§impl ResolvConf
impl ResolvConf
§Parsing Configuration File
Trait Implementations§
source§impl Clone for ResolvConf
impl Clone for ResolvConf
source§fn clone(&self) -> ResolvConf
fn clone(&self) -> ResolvConf
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more