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/05/06 15:23:51 UTC

[GitHub] [apisix] tzssangglass commented on a diff in pull request #6988: feat(real-ip): support search recursive

tzssangglass commented on code in PR #6988:
URL: https://github.com/apache/apisix/pull/6988#discussion_r866934795


##########
apisix/plugins/real-ip.lua:
##########
@@ -67,6 +73,19 @@ function _M.check_schema(conf)
 end
 
 
+local function addr_match(conf, addr)
+    if not conf.trusted_addresses then
+        return false
+    end
+
+    if not conf.matcher then
+        conf.matcher = core.ip.create_ip_matcher(conf.trusted_addresses)
+    end

Review Comment:
   It is bad practice to add properties to conf, and we should keep conf pure. How about making `matcher` a module-level variable?



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