You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/05/23 13:22:05 UTC

[GitHub] [bookkeeper] tal705 opened a new pull request, #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

tal705 opened a new pull request, #3288:
URL: https://github.com/apache/bookkeeper/pull/3288

   
   ### Motivation
   Fix https://github.com/apache/bookkeeper/issues/3287
   Fix the bug for ipv6 ip can not be recognized.
   
   ### Changes
   1. Add some code in `org.apache.bookkeeper.common.net.ServiceURI` to deal with ipv6 ip.  
   2. Improve the Unit Test.
   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] hangc0276 commented on pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#issuecomment-1165471177

   The same with https://github.com/apache/bookkeeper/pull/3158


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] StevenLuMT commented on pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
StevenLuMT commented on PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#issuecomment-1225341568

   fix old workflow,please see #3455 for detail


-- 
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: commits-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] tal705 commented on pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
tal705 commented on PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#issuecomment-1138566968

   @sijie could you review it? thank you very much.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] tal705 commented on pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
tal705 commented on PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#issuecomment-1149820833

   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on code in PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#discussion_r905954055


##########
bookkeeper-common/src/main/java/org/apache/bookkeeper/common/net/ServiceURI.java:
##########
@@ -145,6 +146,39 @@ public class ServiceURI {
     public static ServiceURI create(String uriStr) {
         checkNotNull(uriStr, "service uri string is null");
 
+        if (uriStr.contains("[") && uriStr.contains("]")) {
+            // deal with ipv6 address
+            Splitter splitter = Splitter.on(CharMatcher.anyOf(",;"));
+            List<String> hosts = splitter.splitToList(uriStr);
+
+            if (hosts.size() > 1) {
+                // deal with multi ipv6 hosts
+                String firstHost = hosts.get(0);
+                String lastHost = hosts.get(hosts.size() - 1);
+                boolean hasPath = lastHost.contains("/");
+                String path = hasPath ? lastHost.substring(lastHost.indexOf("/")) : "";
+                firstHost += path;
+
+                URI uri = URI.create(firstHost);
+                ServiceURI serviceURI = create(uri);
+
+                List<String> multiHosts = new ArrayList<>();
+                multiHosts.add(serviceURI.getServiceHosts()[0]);
+                multiHosts.addAll(hosts.subList(1, hosts.size()));
+                multiHosts = multiHosts
+                    .stream()
+                    .map(host -> validateHostName(serviceURI.getServiceName(), host))
+                    .collect(Collectors.toList());
+                return new ServiceURI(
+                    serviceURI.getServiceName(),
+                    serviceURI.getServiceInfos(),
+                    serviceURI.getServiceUser(),
+                    multiHosts.toArray(new String[multiHosts.size()]),
+                    serviceURI.getServicePath(),
+                    serviceURI.getUri());
+            }

Review Comment:
   Do we need to deal with hosts.size() == 1 ?



-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] tal705 commented on pull request #3288: [ISSUE 3287] Fix the bug that ipv6 ip can not be recognized

Posted by GitBox <gi...@apache.org>.
tal705 commented on PR #3288:
URL: https://github.com/apache/bookkeeper/pull/3288#issuecomment-1157462972

   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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