E-MailRelay
|
Implements DNS blocklisting, as per RFC-5782. More...
#include <gdnsblock.h>
Public Types | |
using | ResultList = std::vector< DnsBlockServerResult > |
Public Member Functions | |
DnsBlock (DnsBlockCallback &, EventState, std::string_view config={}) | |
Constructor. More... | |
void | configure (const Address &dns_server, unsigned int threshold, bool allow_on_timeout, G::TimeInterval timeout, const G::StringArray &servers) |
Configures the object after construction. More... | |
void | configure (std::string_view) |
Configuration overload taking a configuration string containing comma-separated fields of: dns-server-address, timeout-ms, threshold, dnsbl-server-list. More... | |
void | start (const Address &) |
Starts an asychronous check on the given address. More... | |
bool | busy () const |
Returns true after start() and before the completion callback. More... | |
DnsBlock (const DnsBlock &)=delete | |
DnsBlock (DnsBlock &&)=delete | |
DnsBlock & | operator= (const DnsBlock &)=delete |
DnsBlock & | operator= (DnsBlock &&)=delete |
Static Public Member Functions | |
static void | checkConfig (const std::string &) |
Checks the configure() string, throwing on error. More... | |
Implements DNS blocklisting, as per RFC-5782.
The implementation sends DNS requests for each configured block-list server incorporating the IP address to be tested, for example "1.0.168.192.nospam.com". All requests go to the same DNS server and are cached or routed in the normal way, so the block-list servers are not contacted directly.
Definition at line 145 of file gdnsblock.h.
using GNet::DnsBlock::ResultList = std::vector<DnsBlockServerResult> |
Definition at line 153 of file gdnsblock.h.
GNet::DnsBlock::DnsBlock | ( | DnsBlockCallback & | callback, |
EventState | es, | ||
std::string_view | config = {} |
||
) |
Constructor.
Use configure() if necessary and then start(), one time only.
Definition at line 69 of file gdnsblock.cpp.
bool GNet::DnsBlock::busy | ( | ) | const |
Returns true after start() and before the completion callback.
Definition at line 240 of file gdnsblock.cpp.
|
static |
Checks the configure() string, throwing on error.
Definition at line 79 of file gdnsblock.cpp.
void GNet::DnsBlock::configure | ( | const Address & | dns_server, |
unsigned int | threshold, | ||
bool | allow_on_timeout, | ||
G::TimeInterval | timeout, | ||
const G::StringArray & | servers | ||
) |
Configures the object after construction.
Definition at line 145 of file gdnsblock.cpp.
void GNet::DnsBlock::configure | ( | std::string_view | config | ) |
Configuration overload taking a configuration string containing comma-separated fields of: dns-server-address, timeout-ms, threshold, dnsbl-server-list.
Definition at line 91 of file gdnsblock.cpp.
void GNet::DnsBlock::start | ( | const Address & | address | ) |
Starts an asychronous check on the given address.
The result is delivered via the callback interface passed to the ctor.
Definition at line 188 of file gdnsblock.cpp.