MarsSec773 commented on issue #3186:
URL: https://github.com/apache/apisix/issues/3186#issuecomment-754352950


   > @MarsSec773
   > Can you try #3187?
   
   Thank you very much for your quick response.
   Everything works great.
   
   By adding [ ] to enclose the IPv6 address additionally, I got running state 
of apisix server.
   ```
   NAME                             READY   STATUS    RESTARTS   AGE
   apisix-server-65fd5bb697-d8xv6   1/1     Running   0          26s
   ```
   I don't have experience of coding Lua. FYI, let me provide my final script.
   ```
   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")
           local addr6, n6 = line:gsub("^nameserver%s+([^%s]+)%s*$", "%1")
           if n == 1 then
               table_insert(dns_addrs, addr)
           end
           if n6 == 1 then
               table_insert(dns_addrs, "[" .. addr6 .. "]")
           end
       end
   
       file:close()
       return dns_addrs
   end
   ```
   Thank you so much @spacewander .


----------------------------------------------------------------
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