44# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
66import socket
7+ import os
78
89from test_framework .socks5 import Socks5Configuration , Socks5Command , Socks5Server , AddressType
910from test_framework .test_framework import BitcoinTestFramework
10- from test_framework .util import *
11+ from test_framework .util import (
12+ PORT_MIN ,
13+ PORT_RANGE ,
14+ start_nodes ,
15+ assert_equal ,
16+ )
1117from test_framework .netutil import test_ipv6_local
1218'''
1319Test plan:
3339addnode connect to generic DNS name
3440'''
3541
42+ RANGE_BEGIN = PORT_MIN + 2 * PORT_RANGE # Start after p2p and rpc ports
43+
3644
3745class ProxyTest (BitcoinTestFramework ):
3846 def __init__ (self ):
@@ -44,19 +52,19 @@ def __init__(self):
4452 # Create two proxies on different ports
4553 # ... one unauthenticated
4654 self .conf1 = Socks5Configuration ()
47- self .conf1 .addr = ('127.0.0.1' , 13000 + (os .getpid () % 1000 ))
55+ self .conf1 .addr = ('127.0.0.1' , RANGE_BEGIN + (os .getpid () % 1000 ))
4856 self .conf1 .unauth = True
4957 self .conf1 .auth = False
5058 # ... one supporting authenticated and unauthenticated (Tor)
5159 self .conf2 = Socks5Configuration ()
52- self .conf2 .addr = ('127.0.0.1' , 14000 + (os .getpid () % 1000 ))
60+ self .conf2 .addr = ('127.0.0.1' , RANGE_BEGIN + 1000 + (os .getpid () % 1000 ))
5361 self .conf2 .unauth = True
5462 self .conf2 .auth = True
5563 if self .have_ipv6 :
5664 # ... one on IPv6 with similar configuration
5765 self .conf3 = Socks5Configuration ()
5866 self .conf3 .af = socket .AF_INET6
59- self .conf3 .addr = ('::1' , 15000 + (os .getpid () % 1000 ))
67+ self .conf3 .addr = ('::1' , RANGE_BEGIN + 2000 + (os .getpid () % 1000 ))
6068 self .conf3 .unauth = True
6169 self .conf3 .auth = True
6270 else :
0 commit comments