mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 06:51:08 +01:00
modules/s_dns: Improve ipport query deduction related.
This commit is contained in:
parent
a1ac9cb356
commit
4677e5f443
1 changed files with 26 additions and 7 deletions
|
@ -38,6 +38,9 @@ ircd::net::dns::resolve(const hostport &hp,
|
|||
|
||||
dns::opts opts(opts_);
|
||||
opts.qtype = opts_.qtype?: 33; // default to SRV
|
||||
|
||||
if(opts.qtype == 33)
|
||||
{
|
||||
opts.nxdomain_exceptions = false;
|
||||
net::dns::callback_one handler
|
||||
{
|
||||
|
@ -46,6 +49,20 @@ ircd::net::dns::resolve(const hostport &hp,
|
|||
|
||||
resolve(hp, opts, std::move(handler));
|
||||
}
|
||||
else if(opts.qtype == 1 || opts.qtype == 28)
|
||||
{
|
||||
net::dns::callback_one handler
|
||||
{
|
||||
std::bind(&handle_resolve_A_ipport, ph::_1, ph::_2, opts, port(hp), std::move(callback))
|
||||
};
|
||||
|
||||
resolve(hp, opts, std::move(handler));
|
||||
}
|
||||
else throw error
|
||||
{
|
||||
"Query type:%u not valid for ipport result callback.", opts.qtype
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
IRCD_MODULE_EXPORT
|
||||
|
@ -162,6 +179,8 @@ ircd::net::dns::handle_resolve_A_ipport(const hostport &hp,
|
|||
|
||||
const json::string &ip
|
||||
{
|
||||
opts.qtype == 28?
|
||||
rr.get("ip", ":::0"_sv):
|
||||
rr.get("ip", "0.0.0.0"_sv)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue