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::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: ResolvOptionsDefault options.
Implementations§
Source§impl ResolvConf
§Management
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
§Parsing Configuration File
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