equal
deleted
inserted
replaced
56 end |
56 end |
57 |
57 |
58 local function new(hostname, port, conn_type, extra) |
58 local function new(hostname, port, conn_type, extra) |
59 local ascii_host = idna_to_ascii(hostname); |
59 local ascii_host = idna_to_ascii(hostname); |
60 local targets = nil; |
60 local targets = nil; |
|
61 conn_type = conn_type or "tcp"; |
61 |
62 |
62 local is_ip = inet_pton(hostname); |
63 local is_ip = inet_pton(hostname); |
63 if not is_ip and hostname:sub(1,1) == '[' then |
64 if not is_ip and hostname:sub(1,1) == '[' then |
64 is_ip = inet_pton(hostname:sub(2,-2)); |
65 is_ip = inet_pton(hostname:sub(2,-2)); |
65 end |
66 end |
73 end |
74 end |
74 |
75 |
75 return setmetatable({ |
76 return setmetatable({ |
76 hostname = ascii_host; |
77 hostname = ascii_host; |
77 port = port; |
78 port = port; |
78 conn_type = conn_type or "tcp"; |
79 conn_type = conn_type; |
79 extra = extra; |
80 extra = extra; |
80 targets = targets; |
81 targets = targets; |
81 }, resolver_mt); |
82 }, resolver_mt); |
82 end |
83 end |
83 |
84 |