You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/08 07:10:44 UTC

[GitHub] [apisix] TenYearsIn commented on a diff in pull request #8270: feat: add method that parse ip from /etc/hosts in high priority

TenYearsIn commented on code in PR #8270:
URL: https://github.com/apache/apisix/pull/8270#discussion_r1016214323


##########
apisix/core/resolver.lua:
##########
@@ -19,15 +19,67 @@
 --
 -- @module core.resolver
 
-local json = require("apisix.core.json")
-local log = require("apisix.core.log")
-local utils = require("apisix.core.utils")
+local json           = require("apisix.core.json")
+local log            = require("apisix.core.log")
+local utils          = require("apisix.core.utils")
+local string_match   = string.match
+local open           = io.open
+
+
+local DEFAULT_HOSTS = "/etc/hosts"
+local HOSTS_IP_MATCH_CACHE = {}
 
 
 local _M = {}
 
 
+local function guess_name_type(name)
+    if name:match("^[%d%.]+$") then
+        return "ipv4"
+    end
+
+    if name:find(":") then
+        return "ipv6"
+    end
+
+    return "hostname"
+end
+
+
+local function init_hosts_ip()

Review Comment:
   Yeah,  I will replace it 



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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org