From 6b4ed71c8a896c353c4a2207f60d3f619bbc4ff0 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 23 May 2017 17:41:24 -0700 Subject: [PATCH] skip non-public IP addresses the old TorManager would return None for these, but txtorcon's new API throws ValueError, which we must catch and skip --- src/wormhole/transit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wormhole/transit.py b/src/wormhole/transit.py index ace76e7..e0a97dd 100644 --- a/src/wormhole/transit.py +++ b/src/wormhole/transit.py @@ -889,9 +889,12 @@ class Common: def _endpoint_from_hint_obj(self, hint): if self._tor: if isinstance(hint, (DirectTCPV1Hint, TorTCPV1Hint)): - # this Tor object will return None for non-public IPv4 + # this Tor object will throw ValueError for non-public IPv4 # addresses and any IPv6 address - return self._tor.stream_via(hint.hostname, hint.port) + try: + return self._tor.stream_via(hint.hostname, hint.port) + except ValueError: + return None return None if isinstance(hint, DirectTCPV1Hint): return endpoints.HostnameEndpoint(self._reactor,