[−][src]Struct domain_resolv::stub::conf::ResolvConf
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: ResolvOptions
Default options.
Methods
impl ResolvConf
[src]
pub fn new() -> Self
[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.
pub fn finalize(&mut self)
[src]
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.
pub fn default() -> Self
[src]
Creates a default configuration for this system.
XXX This currently only works for Unix-y systems.
impl ResolvConf
[src]
pub fn parse_file<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error>
[src]
Parses the configuration from a file.
pub fn parse<R: Read>(&mut self, reader: &mut R) -> Result<(), Error>
[src]
Parses the configuration from a reader.
The format is that of the /etc/resolv.conf file.
Trait Implementations
impl Default for ResolvConf
[src]
impl Clone for ResolvConf
[src]
fn clone(&self) -> ResolvConf
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Display for ResolvConf
[src]
impl Debug for ResolvConf
[src]
Auto Trait Implementations
impl Send for ResolvConf
impl Sync for ResolvConf
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.