Mercurial > prosody-hg
comparison net/resolvers/basic.lua @ 11008:fd735fe2fc50
Merge 0.11->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 10 Jul 2020 13:01:17 +0100 |
| parents | 4603697aee50 1d8e1f7a587c |
| children | 5a71f14ab77c |
comparison
equal
deleted
inserted
replaced
| 11006:8ac958938e0f | 11008:fd735fe2fc50 |
|---|---|
| 68 end | 68 end |
| 69 | 69 |
| 70 local function new(hostname, port, conn_type, extra) | 70 local function new(hostname, port, conn_type, extra) |
| 71 local ascii_host = idna_to_ascii(hostname); | 71 local ascii_host = idna_to_ascii(hostname); |
| 72 local targets = nil; | 72 local targets = nil; |
| 73 conn_type = conn_type or "tcp"; | |
| 73 | 74 |
| 74 local is_ip = inet_pton(hostname); | 75 local is_ip = inet_pton(hostname); |
| 75 if not is_ip and hostname:sub(1,1) == '[' then | 76 if not is_ip and hostname:sub(1,1) == '[' then |
| 76 is_ip = inet_pton(hostname:sub(2,-2)); | 77 is_ip = inet_pton(hostname:sub(2,-2)); |
| 77 end | 78 end |
| 85 end | 86 end |
| 86 | 87 |
| 87 return setmetatable({ | 88 return setmetatable({ |
| 88 hostname = ascii_host; | 89 hostname = ascii_host; |
| 89 port = port; | 90 port = port; |
| 90 conn_type = conn_type or "tcp"; | 91 conn_type = conn_type; |
| 91 extra = extra; | 92 extra = extra; |
| 92 targets = targets; | 93 targets = targets; |
| 93 }, resolver_mt); | 94 }, resolver_mt); |
| 94 end | 95 end |
| 95 | 96 |
