pub enum ResolvePolicy {
    Agnostic,
    ResolveToIPv4,
    ResolveToIPv6,
}
Expand description

A ResolvePolicy allows control over IP address resolution of network targets like IcmpTarget and TcpTarget.

Variants

Agnostic

Resolve use all IP address versions

ResolveToIPv4

Resolve to IPv4 addresses only

ResolveToIPv6

Resolve to IPv6 addresses only

Implementations

Resolve given “fully qualified domain name” (fancy name for a hostname or ip address) to a series of ip addresses associated with given fqhn.

Arguments
  • fqhn: string containing “fully qualified domain name” e.g. “::1”, “localhost”.
Returns
  • On success, vector containing all ip addresses the fqhn resolved to.
  • On failure, a ResolveTargetError. Either failed the name resolution itself or all addresses were filtered out according to ResolvePolicy.
Example

// FQHN was resolved
assert_eq!(
    ResolvePolicy::Agnostic.resolve("127.0.0.1").unwrap(),
    vec![IpAddr::V4(Ipv4Addr::LOCALHOST)]
);

// FQHN was resolved, but all Addresses were filtered
assert_eq!(ResolvePolicy::ResolveToIPv6.resolve("127.0.0.1").is_err(), true);

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.