MarsSec773 opened a new issue #3186:
URL: https://github.com/apache/apisix/issues/3186


   # Improve Docs
   Continue with #3184
   I got an error of "local DNS is empty" when I try to deploy a APISIX pod.
   I specified DNS resolver as IPv6 address.
   
   ## Please describe which part of docs should be improved or typo fixed
   Source code with the error:
   ```
       local dns_resolver = sys_conf["dns_resolver"]
       if not dns_resolver or #dns_resolver == 0 then
           local dns_addrs, err = local_dns_resolver("/etc/resolv.conf")
           if not dns_addrs then
               util.die("failed to import local DNS: ", err, "\n")
           end
   
           if #dns_addrs == 0 then
               util.die("local DNS is empty\n")
           end
   
           sys_conf["dns_resolver"] = dns_addrs
       end
   ```
   DNS address is not read because local_dns_resolver function doesn't parse 
IPv6 address.
   We can see the regex.
   ```
   local function local_dns_resolver(file_path)
       local file, err = io_open(file_path, "rb")
       if not file then
           return false, "failed to open file: " .. file_path .. ", error 
info:" .. err
       end
   
       local dns_addrs = {}
       for line in file:lines() do
           local addr, n = line:gsub("^nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$", 
"%1")
           if n == 1 then
               table_insert(dns_addrs, addr)
           end
       end
   
       file:close()
       return dns_addrs
   end
   ```
   I hope this improvement could be applied, thanks.
   
   
   ## Describe the solution you'd like
   
   Add a regex for IPv6 DNS resolver.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to