Struct domain::resolv::stub::conf::ResolvConf [−][src]
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.
Implementations
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 Clone for ResolvConf
[src]
fn clone(&self) -> ResolvConf
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ResolvConf
[src]
impl Default for ResolvConf
[src]
impl Display for ResolvConf
[src]
Auto Trait Implementations
impl RefUnwindSafe for ResolvConf
impl Send for ResolvConf
impl Sync for ResolvConf
impl Unpin for ResolvConf
impl UnwindSafe for ResolvConf
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<Source, Target> OctetsInto<Target> for Source where
Target: OctetsFrom<Source>,
[src]
Target: OctetsFrom<Source>,
pub fn octets_into(Self) -> Result<Target, ShortBuf>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,