Skip to main content

Crate tokio_dns

Crate tokio_dns 

Source
Expand description

This crate offers tools for asynchronous name resolution, and extensions to the tokio_core crate.

First, Endpoint and ToEndpoint behave very much like SocketAddr and ToSocketAddrs from the standard library. The main difference is that the ToEndpoint trait does not perform any name resolution. If simply detect whether the given endpoint is a socket address or a host name. Then, it is up to a resolver to perform name resolution.

The Resolver trait describes an abstract, asynchronous resolver. This crate provides one (for now) implementation of a resolver, the CpuPoolResolver. It uses a thread pool and the ToSocketAddrs trait to perform name resolution.

The crate level functions tcp_connect, tcp_listen and udp_bind support name resolution via a lazy static CpuPoolResolver using 5 threads. Their *_with counterpart take a resolver as an argument.

Git Repository

Structs§

CpuPoolResolver
A resolver based on a thread pool.
TcpListener
Shim for tokio::net::TcpListener
TcpStream
Shim for tokio::net::TcpStream
UdpSocket
Shim for tokio::net::UdpSocket

Enums§

Endpoint
An Endpoint is a way of identifying the target of a connection.

Traits§

Resolver
The Resolver trait represents an object capable of resolving host names into IP addresses.
ToEndpoint
A trait for objects that can be converted into an Endpoint.

Functions§

resolveDeprecated
Resolve a hostname to a sequence of ip addresses using the default resolver.
resolve_ip_addr
Resolve a hostname to a sequence of ip addresses using the default resolver.
resolve_ip_addr_with
Resolve a hostname to a sequence of ip addresses using a custom resolver.
resolve_sock_addr
Resolve an endpoint to a sequence of socket addresses using the default resolver.
resolve_sock_addr_with
Resolve an endpoint to a sequence of socket addresses using a custom resolver.

Type Aliases§

IoFuture
An alias for the futures produced by this library.