Struct flytrap::Resolver

source ·
pub struct Resolver(/* private fields */);
Available on crate feature dns only.
Expand description

Query the Fly.io internal DNS records.

Implementations§

source§

impl Resolver

source

pub fn new() -> Result<Self, Error>

Available on crate features detect or environment only.

Create a Resolver which configures itself based on the host’s detected Fly.io private network address.

If the host does not appear to be running under Fly.io or connected to the Wireguard VPN, an Unavailable error will be returned.

source

pub fn with_source(source: SocketAddr, local: Option<SocketAddr>) -> Self

Create a Resolver which will send DNS queries to the given source server to determine your Fly.io application topology.

If local is specified, sockets used to send DNS queries will be bound to the given address.

source

pub fn with_sources( sources: impl IntoIterator<Item = SocketAddr>, local: Option<SocketAddr> ) -> Self

Create a Resolver which will send DNS queries to the given sources to determine your Fly.io application topology.

To set sources automatically based on the operating systems’ DNS resolution configuration, see Resolver::system.

If local is specified, sockets used to send DNS queries will be bound to the given address.

source

pub fn system() -> Result<Self, Error>

Available on crate feature system-resolver only.

Create a Resolver which will send DNS queries to the nameservers configured in the host operating system (i.e., in /etc/resolv.conf).

source

pub fn app(&self, name: impl Into<String>) -> AppResolver<'_>

Create an AppResolver for querying the named app.

source

pub fn current(&self) -> Result<AppResolver<'_>, Error>

Available on crate feature environment only.

Create an AppResolver for querying the running app (as set by $FLY_APP_NAME).

If $FLY_APP_NAME is unset, an Unavailable error is returned.

source

pub async fn apps(&self) -> Result<Vec<String>, Error>

Find all apps in the current Fly.io organization.

source

pub async fn instances(&self) -> Result<Vec<Instance>, Error>

Find all running instances in the current Fly.io organization, across all apps.

source

pub async fn txt(&self, name: impl IntoName) -> Result<String, Error>

Perform an arbitrary TXT record query on the .internal domain.

Trait Implementations§

source§

impl Clone for Resolver

source§

fn clone(&self) -> Resolver

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<AsyncResolver<GenericConnector<TokioRuntimeProvider>>> for Resolver

source§

fn from(value: TokioAsyncResolver) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more