equal
deleted
inserted
replaced
|
1 local s = require"util.serialization".new"oneline".serialize; |
1 |
2 |
2 module:set_global(); |
3 module:set_global(); |
3 |
4 |
4 local adns = require "net.adns"; |
5 local adns = require "net.adns"; |
5 |
6 |
23 end |
24 end |
24 end |
25 end |
25 |
26 |
26 local original_lookup = adns.lookup; |
27 local original_lookup = adns.lookup; |
27 function adns.lookup(handler, qname, qtype, qclass) |
28 function adns.lookup(handler, qname, qtype, qclass) |
|
29 module:log("debug", "adns.lookup(%s, %s, %s)", s(qname), s(qtype), s(qclass)); |
28 if qtype == "SRV" then |
30 if qtype == "SRV" then |
29 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$"); |
31 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$"); |
|
32 module:log("debug", "qname:match(...) → %s", s(host)); |
|
33 local mapping = map[host] or map["*"]; |
|
34 module:log("debug", "map[%s] → %s", s(host), s(mapping)); |
30 local mapping = map[host] or map["*"]; |
35 local mapping = map[host] or map["*"]; |
31 if mapping then |
36 if mapping then |
32 handler(mapping); |
37 handler(mapping); |
33 return; |
38 return; |
34 end |
39 end |