use ipaddress not ipaddr

This commit is contained in:
meejah 2016-06-02 11:16:04 -07:00
parent 7b0ca28589
commit 5b23669cf3
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ setup(name="magic-wormhole",
"autobahn[twisted] >= 0.14.1", "autobahn[twisted] >= 0.14.1",
"hkdf", "tqdm", "hkdf", "tqdm",
], ],
extras_require={"tor": ["txtorcon", "ipaddr"]}, extras_require={"tor": ["txtorcon", "ipaddress"]},
test_suite="wormhole.test", test_suite="wormhole.test",
cmdclass=commands, cmdclass=commands,
) )

View File

@ -3,7 +3,7 @@ import time
from twisted.internet.defer import inlineCallbacks, returnValue from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.error import ConnectError from twisted.internet.error import ConnectError
import txtorcon import txtorcon
import ipaddr import ipaddress
from .timing import DebugTiming from .timing import DebugTiming
from .transit import allocate_tcp_port from .transit import allocate_tcp_port
@ -112,7 +112,7 @@ class TorManager:
# for numeric hostnames, skip RFC1918 addresses, since no Tor exit # for numeric hostnames, skip RFC1918 addresses, since no Tor exit
# node will be able to reach those. Likewise ignore IPv6 addresses. # node will be able to reach those. Likewise ignore IPv6 addresses.
try: try:
a = ipaddr.IPAddress(host) a = ipaddress.ip_address(host)
except ValueError: except ValueError:
return False # non-numeric, let Tor try it return False # non-numeric, let Tor try it
if a.version != 4: if a.version != 4: