This class represents an asynchronous DNS resolver.
More...
#include <trantor/net/Resolver.h>
|
| virtual void | resolve (const std::string &hostname, const Callback &callback)=0 |
| | Resolve an address asynchronously.
|
| virtual void | resolve (const std::string &hostname, const ResolverResultsCallback &callback)=0 |
| | Resolve an address array asynchronously.
|
This class represents an asynchronous DNS resolver.
- Note
- Although the c-ares library is not essential, it is recommended to install it for higher performance
◆ ResolverResultsCallback
| using trantor::Resolver::ResolverResultsCallback |
Initial value:
std::function<void(const std::vector<trantor::InetAddress>&)>
◆ isCAresUsed()
| bool trantor::Resolver::isCAresUsed |
( |
| ) |
|
|
static |
Check whether the c-ares library is used.
- Returns
- true
-
false
◆ newResolver()
| std::shared_ptr< Resolver > trantor::Resolver::newResolver |
( |
EventLoop * | loop = nullptr, |
|
|
size_t | timeout = 60 ) |
|
static |
Create a new DNS resolver.
- Parameters
-
| loop | The event loop in which the DNS resolver runs. |
| timeout | The timeout in seconds for DNS. |
- Returns
- std::shared_ptr<Resolver>
◆ resolve() [1/2]
| virtual void trantor::Resolver::resolve |
( |
const std::string & | hostname, |
|
|
const Callback & | callback ) |
|
pure virtual |
Resolve an address asynchronously.
- Parameters
-
◆ resolve() [2/2]
| virtual void trantor::Resolver::resolve |
( |
const std::string & | hostname, |
|
|
const ResolverResultsCallback & | callback ) |
|
pure virtual |
Resolve an address array asynchronously.
- Parameters
-
The documentation for this class was generated from the following file: