コード例 #1
0
    def setup_nodes(self):
        self.have_ipv6 = test_ipv6_local()
        # Create two proxies on different ports
        # ... one unauthenticated
        self.conf1 = Socks5Configuration()
        self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000))
        self.conf1.unauth = True
        self.conf1.auth = False
        # ... one supporting authenticated and unauthenticated (Tor)
        self.conf2 = Socks5Configuration()
        self.conf2.addr = ('127.0.0.1',
                           RANGE_BEGIN + 1000 + (os.getpid() % 1000))
        self.conf2.unauth = True
        self.conf2.auth = True
        if self.have_ipv6:
            # ... one on IPv6 with similar configuration
            self.conf3 = Socks5Configuration()
            self.conf3.af = socket.AF_INET6
            self.conf3.addr = ('::1',
                               RANGE_BEGIN + 2000 + (os.getpid() % 1000))
            self.conf3.unauth = True
            self.conf3.auth = True
        else:
            self.log.warning("Testing without local IPv6 support")

        self.serv1 = Socks5Server(self.conf1)
        self.serv1.start()
        self.serv2 = Socks5Server(self.conf2)
        self.serv2.start()
        if self.have_ipv6:
            self.serv3 = Socks5Server(self.conf3)
            self.serv3.start()

        # Note: proxies are not used to connect to local nodes
        # this is because the proxy to use is based on CService.GetNetwork(), which return NET_UNROUTABLE for localhost
        args = [[
            '-listen',
            '-proxy=%s:%i' % (self.conf1.addr), '-proxyrandomize=1'
        ],
                [
                    '-listen',
                    '-proxy=%s:%i' % (self.conf1.addr),
                    '-onion=%s:%i' % (self.conf2.addr), '-proxyrandomize=0'
                ],
                [
                    '-listen',
                    '-proxy=%s:%i' % (self.conf2.addr), '-proxyrandomize=1'
                ], []]
        if self.have_ipv6:
            args[3] = [
                '-listen',
                '-proxy=[%s]:%i' % (self.conf3.addr), '-proxyrandomize=0',
                '-noonion'
            ]
        self.add_nodes(self.num_nodes, extra_args=args)
        self.start_nodes()
コード例 #2
0
    def __init__(self):
        super().__init__()
        self.num_nodes = 4
        self.setup_clean_chain = False

        self.have_ipv6 = test_ipv6_local()
        # Create two proxies on different ports
        # ... one unauthenticated
        self.conf1 = Socks5Configuration()
        self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000))
        self.conf1.unauth = True
        self.conf1.auth = False
        # ... one supporting authenticated and unauthenticated (Tor)
        self.conf2 = Socks5Configuration()
        self.conf2.addr = ('127.0.0.1',
                           RANGE_BEGIN + 1000 + (os.getpid() % 1000))
        self.conf2.unauth = True
        self.conf2.auth = True
        if self.have_ipv6:
            # ... one on IPv6 with similar configuration
            self.conf3 = Socks5Configuration()
            self.conf3.af = socket.AF_INET6
            self.conf3.addr = ('::1',
                               RANGE_BEGIN + 2000 + (os.getpid() % 1000))
            self.conf3.unauth = True
            self.conf3.auth = True
        else:
            print("Warning: testing without local IPv6 support")

        self.serv1 = Socks5Server(self.conf1)
        self.serv1.start()
        self.serv2 = Socks5Server(self.conf2)
        self.serv2.start()
        if self.have_ipv6:
            self.serv3 = Socks5Server(self.conf3)
            self.serv3.start()
コード例 #3
0
        # ... one supporting authenticated and unauthenticated (Tor)
        self.conf2 = Socks5Configuration()
        self.conf2.addr = ('127.0.0.1', 14000 + (os.getpid() % 1000))
        self.conf2.unauth = True
        self.conf2.auth = True
if self.have_ipv6:
# ... one on IPv6 with similar configuration
self.conf3 = Socks5Configuration()
self.conf3.af = socket.AF_INET6
self.conf3.addr = ('::1', 15000 + (os.getpid() % 1000))
self.conf3.unauth = True
self.conf3.auth = True
else:
  print "Warning: testing without local IPv6 support"

        self.serv1 = Socks5Server(self.conf1)
        self.serv1.start()
        self.serv2 = Socks5Server(self.conf2)
        self.serv2.start()
 if self.have_ipv6:
  self.serv3 = Socks5Server(self.conf3)  
self.serv3.start()

    def setup_nodes(self):
        # Note: proxies are not used to connect to local nodes
        # this is because the proxy to use is based on CService.GetNetwork(), which return NET_UNROUTABLE for localhost

 args = [
            ['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf1.addr),'-proxyrandomize=1'], 
            ['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf1.addr),'-onion=%s:%i' % (self.conf2.addr),'-proxyrandomize=0'], 
            ['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf2.addr),'-proxyrandomize=1'], 
コード例 #4
0
    def setup_nodes(self):
        self.have_ipv6 = test_ipv6_local()
        # Create two proxies on different ports
        # ... one unauthenticated
        self.conf1 = Socks5Configuration()
        self.conf1.addr = ('127.0.0.1', p2p_port(self.num_nodes))
        self.conf1.unauth = True
        self.conf1.auth = False
        # ... one supporting authenticated and unauthenticated (Tor)
        self.conf2 = Socks5Configuration()
        self.conf2.addr = ('127.0.0.1', p2p_port(self.num_nodes + 1))
        self.conf2.unauth = True
        self.conf2.auth = True
        if self.have_ipv6:
            # ... one on IPv6 with similar configuration
            self.conf3 = Socks5Configuration()
            self.conf3.af = socket.AF_INET6
            self.conf3.addr = ('::1', p2p_port(self.num_nodes + 2))
            self.conf3.unauth = True
            self.conf3.auth = True
        else:
            self.log.warning("Testing without local IPv6 support")

        self.serv1 = Socks5Server(self.conf1)
        self.serv1.start()
        self.serv2 = Socks5Server(self.conf2)
        self.serv2.start()
        if self.have_ipv6:
            self.serv3 = Socks5Server(self.conf3)
            self.serv3.start()

        # We will not try to connect to this.
        self.i2p_sam = ('127.0.0.1', 7656)

        # Note: proxies are not used to connect to local nodes. This is because the proxy to
        # use is based on CService.GetNetwork(), which returns NET_UNROUTABLE for localhost.
        args = [[
            '-listen', f'-proxy={self.conf1.addr[0]}:{self.conf1.addr[1]}',
            '-proxyrandomize=1'
        ],
                [
                    '-listen',
                    f'-proxy={self.conf1.addr[0]}:{self.conf1.addr[1]}',
                    f'-onion={self.conf2.addr[0]}:{self.conf2.addr[1]}',
                    f'-i2psam={self.i2p_sam[0]}:{self.i2p_sam[1]}',
                    '-i2pacceptincoming=0', '-proxyrandomize=0'
                ],
                [
                    '-listen',
                    f'-proxy={self.conf2.addr[0]}:{self.conf2.addr[1]}',
                    '-proxyrandomize=1'
                ], [],
                [
                    '-listen',
                    f'-proxy={self.conf1.addr[0]}:{self.conf1.addr[1]}',
                    '-proxyrandomize=1', '-cjdnsreachable'
                ]]
        if self.have_ipv6:
            args[3] = [
                '-listen',
                f'-proxy=[{self.conf3.addr[0]}]:{self.conf3.addr[1]}',
                '-proxyrandomize=0', '-noonion'
            ]
        self.add_nodes(self.num_nodes, extra_args=args)
        self.start_nodes()