You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/24 06:29:11 UTC

[GitHub] [dubbo] kylixs commented on a change in pull request #8876: [3.0] socks proxy filtering local address

kylixs commented on a change in pull request #8876:
URL: https://github.com/apache/dubbo/pull/8876#discussion_r715349147



##########
File path: dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
##########
@@ -127,6 +128,16 @@ protected void initChannel(SocketChannel ch) throws Exception {
         });
     }
 
+    private boolean isFilteredAddress(String host) {
+        // filter local address
+        if (StringUtils.isEquals(NetUtils.getLocalHost(), host) ||
+            "localhost".equals(host) ||

Review comment:
       I found this method to check whether is localhost: `org.apache.dubbo.common.utils.NetUtils.isLocalHost()`
   
   `StringUtils.equalsAny()`  is essentially the same, checking each string once for equality.
   ```java
       public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) {
           if (ArrayUtils.isNotEmpty(searchStrings)) {
               for (final CharSequence next : searchStrings) {
                   if (equals(string, next)) {
                       return true;
                   }
               }
           }
           return false;
       }
   ```




-- 
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@dubbo.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org