Mercurial > prosody-modules
comparison mod_srvinjection/mod_srvinjection.lua @ 1592:47fb4f36dacd
Add support for IPv4 addresses in SRV injections
| author | Ashley Ward <ashley.ward@surevine.com> |
|---|---|
| date | Tue, 20 Jan 2015 11:02:14 +0000 |
| parents | b21236b6b8d8 |
| children |
comparison
equal
deleted
inserted
replaced
| 1591:21e439ca7208 | 1592:47fb4f36dacd |
|---|---|
| 30 local mapping = map[host] or map["*"]; | 30 local mapping = map[host] or map["*"]; |
| 31 if mapping then | 31 if mapping then |
| 32 handler(mapping); | 32 handler(mapping); |
| 33 return; | 33 return; |
| 34 end | 34 end |
| 35 elseif qtype == "A" and (qname == "localhost." or qname == "127.0.0.1.") then | 35 elseif qtype == "A" then |
| 36 handler({{ a = "127.0.0.1" }}); | 36 if (qname == "localhost." or qname == "127.0.0.1.") then |
| 37 return; | 37 handler({{ a = "127.0.0.1" }}); |
| 38 return; | |
| 39 end | |
| 40 local ip = qname:match("^(%d+.%d+.%d+.%d+).$"); | |
| 41 if ip then | |
| 42 handler({{ a = ip }}); | |
| 43 return; | |
| 44 end | |
| 38 end | 45 end |
| 39 return original_lookup(handler, qname, qtype, qclass); | 46 return original_lookup(handler, qname, qtype, qclass); |
| 40 end | 47 end |
| 41 | 48 |
| 42 function module.unload() | 49 function module.unload() |
