Crate tokio_dns [] [src]

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.

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

tcp_bind

Bind to the endpoint using the default resolver.

tcp_bind_with

Bind to the endpoint using a custom resolver.

tcp_connect

Connect to the endpoint using the default resolver.

tcp_connect_with

Connect to the endpoint using a custom resolver.

udp_bind

Bind to the endpoint using the default resolver.

udp_bind_with

Bind to the endpoint using a custom resolver.