Skip to content

Commit

Permalink
parse_resolv_conf
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Jul 19, 2024
1 parent 3236a66 commit d63a7ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kong/dns/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ local function parse_resolv_conf(path, enable_ipv6)

-- nameservers
if resolv.nameserver then
local n = 0
local nameservers = {}

for _, address in ipairs(resolv.nameserver) do
local ip, port, t = utils.parseHostname(address)
if t == "ipv4" or
(t == "ipv6" and not ip:find([[%]], nil, true) and enable_ipv6)
then
table_insert(nameservers, port and { ip, port } or ip)
n = n + 1
nameservers[n] = port and { ip, port } or ip
end
end

Expand Down

0 comments on commit d63a7ba

Please sign in to comment.