spacewander commented on code in PR #7861:
URL: https://github.com/apache/apisix/pull/7861#discussion_r963276236
##########
apisix/plugins/proxy-mirror.lua:
##########
@@ -59,9 +61,30 @@ function _M.check_schema(conf)
end
+local function resolver_host(prop_host)
+ local url_decoded = url.parse(prop_host)
+ local decoded_host = url_decoded.host
+ if not core.utils.parse_ipv4(decoded_host) and not
core.utils.parse_ipv6(decoded_host) then
+ local ip, err = core.resolver.parse_domain(decoded_host)
+
+ if err then
Review Comment:
For code style, I would prefer to use `if not ip`
##########
apisix/plugins/proxy-mirror.lua:
##########
@@ -59,9 +61,30 @@ function _M.check_schema(conf)
end
+local function resolver_host(prop_host)
+ local url_decoded = url.parse(prop_host)
+ local decoded_host = url_decoded.host
+ if not core.utils.parse_ipv4(decoded_host) and not
core.utils.parse_ipv6(decoded_host) then
+ local ip, err = core.resolver.parse_domain(decoded_host)
+
+ if err then
+ core.log.error("dns resolver resolves domain: ", decoded_host, "
error: ", err,
+ " will continue to use the host: ", decoded_host)
Review Comment:
The indentation can be better
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]