A Rust wrapper for the c-ares library, for
asynchronous DNS requests.
This repository contains three crates:
- c-ares-sys is autogenerated unsafe bindings. It is unlikely that you should want to use this directly.
- c-ares is a safe wrapper around those
bindings.
If your
c-aresis sufficiently recent (1.26+) and built with thread-safety, it should be quite ergonomic to use this crate directly. See theevent_threadexample. Otherwise you will need to manage your own event loop. - c-ares-resolver builds on these crates to offer a friendlier API. It manages an event loop for you, and also provides a variety of resolvers: using callbacks, using futures, or blocking.
By default, we will use the c-ares installed on your system, if available.
Force use of the vendored c-ares with the vendored feature.
Deny use of the vendored c-ares by removing the default maybe-vendored
feature.
Setting the feature build-cmake will cause the c-ares library to be built
using cmake.
This is significantly faster than the default autotools build on unix
platforms: so if it works for you, you should probably prefer it.
Contributions are welcome. Please send pull requests!