txtorcon icon indicating copy to clipboard operation
txtorcon copied to clipboard

does stream_via() reject ipv6 addresses?

Open warner opened this issue 7 years ago • 2 comments

I'm updating magic-wormhole to use the new txtorcon APIs, and I noticed one difference between the _is_non_public_numeric_address() function in txtorcon and the one in magic-wormhole that inspired it. The magic-wormhole one checks for a.version != 4, to skip IPv6 addresses.

Should this be added to txtorcon?

diff --git a/txtorcon/controller.py b/txtorcon/controller.py
index 61b6ac2..f534ae3 100644
--- a/txtorcon/controller.py
+++ b/txtorcon/controller.py
@@ -663,7 +663,7 @@ def _is_non_public_numeric_address(host):
     except ValueError:
         return False        # non-numeric, let Tor try it
     if a.is_loopback or a.is_multicast or a.is_private or a.is_reserved \
-       or a.is_unspecified:
+       or a.is_unspecified or a.version != 4:
         return True         # too weird, don't connect
     return False

warner avatar May 24 '17 00:05 warner

Oh, I see test_controller.TorStreamTests.test_public_v6, which has a comment that says "should not be an error". Does Tor handle IPv6 these days?

warner avatar May 24 '17 00:05 warner

Yes, Tor handles IPv6 now.

meejah avatar May 24 '17 06:05 meejah