2016-05-06 11:23:48 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Copyright (c) 2015-2016 The Bitcoin Core developers
|
2015-04-17 19:26:03 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2020-06-11 10:39:04 +02:00
|
|
|
"""Test dashd with different proxy configuration.
|
2016-05-06 11:23:48 +02:00
|
|
|
|
2015-04-17 19:26:03 +02:00
|
|
|
Test plan:
|
2020-06-11 10:39:04 +02:00
|
|
|
- Start dashd's with different proxy configurations
|
2015-04-17 19:26:03 +02:00
|
|
|
- Use addnode to initiate connections
|
|
|
|
- Verify that proxies are connected to, and the right connection command is given
|
2020-06-11 10:39:04 +02:00
|
|
|
- Proxy configurations to test on dashd side:
|
2015-04-17 19:26:03 +02:00
|
|
|
- `-proxy` (proxy everything)
|
|
|
|
- `-onion` (proxy just onions)
|
|
|
|
- `-proxyrandomize` Circuit randomization
|
|
|
|
- Proxy configurations to test on proxy side,
|
|
|
|
- support no authentication (other proxy)
|
|
|
|
- support no authentication + user/pass authentication (Tor)
|
|
|
|
- proxy on IPv6
|
|
|
|
|
|
|
|
- Create various proxies (as threads)
|
2023-04-16 07:18:06 +02:00
|
|
|
- Create nodes that connect to them
|
|
|
|
- Manipulate the peer connections using addnode (onetry) and observe effects
|
|
|
|
- Test the getpeerinfo `network` field for the peer
|
2015-04-17 19:26:03 +02:00
|
|
|
|
|
|
|
addnode connect to IPv4
|
|
|
|
addnode connect to IPv6
|
|
|
|
addnode connect to onion
|
|
|
|
addnode connect to generic DNS name
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
|
|
|
|
- Test getnetworkinfo for each node
|
2019-01-07 10:55:35 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
import socket
|
|
|
|
import os
|
|
|
|
|
|
|
|
from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
|
|
from test_framework.util import (
|
|
|
|
PORT_MIN,
|
|
|
|
PORT_RANGE,
|
|
|
|
assert_equal,
|
|
|
|
)
|
|
|
|
from test_framework.netutil import test_ipv6_local
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2016-11-16 10:04:05 +01:00
|
|
|
RANGE_BEGIN = PORT_MIN + 2 * PORT_RANGE # Start after p2p and rpc ports
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
|
2021-01-19 15:35:56 +01:00
|
|
|
# Networks returned by RPC getpeerinfo.
|
|
|
|
NET_UNROUTABLE = "not_publicly_routable"
|
2023-04-16 07:18:06 +02:00
|
|
|
NET_IPV4 = "ipv4"
|
|
|
|
NET_IPV6 = "ipv6"
|
|
|
|
NET_ONION = "onion"
|
2020-11-18 17:13:27 +01:00
|
|
|
NET_I2P = "i2p"
|
2023-04-16 07:18:06 +02:00
|
|
|
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
# Networks returned by RPC getnetworkinfo, defined in src/rpc/net.cpp::GetNetworksInfo()
|
2020-11-18 17:13:27 +01:00
|
|
|
NETWORKS = frozenset({NET_IPV4, NET_IPV6, NET_ONION, NET_I2P})
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
|
2016-11-16 10:04:05 +01:00
|
|
|
|
2015-12-02 18:12:23 +01:00
|
|
|
class ProxyTest(BitcoinTestFramework):
|
2017-09-01 18:47:13 +02:00
|
|
|
def set_test_params(self):
|
2016-05-20 15:16:51 +02:00
|
|
|
self.num_nodes = 4
|
2019-02-25 17:44:18 +01:00
|
|
|
self.setup_clean_chain = True
|
2016-05-20 15:16:51 +02:00
|
|
|
|
2017-03-19 10:13:45 +01:00
|
|
|
def setup_nodes(self):
|
2016-02-09 12:37:05 +01:00
|
|
|
self.have_ipv6 = test_ipv6_local()
|
2015-04-17 19:26:03 +02:00
|
|
|
# Create two proxies on different ports
|
|
|
|
# ... one unauthenticated
|
|
|
|
self.conf1 = Socks5Configuration()
|
2016-11-16 10:04:05 +01:00
|
|
|
self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000))
|
2015-04-17 19:26:03 +02:00
|
|
|
self.conf1.unauth = True
|
|
|
|
self.conf1.auth = False
|
|
|
|
# ... one supporting authenticated and unauthenticated (Tor)
|
|
|
|
self.conf2 = Socks5Configuration()
|
2016-11-16 10:04:05 +01:00
|
|
|
self.conf2.addr = ('127.0.0.1', RANGE_BEGIN + 1000 + (os.getpid() % 1000))
|
2015-04-17 19:26:03 +02:00
|
|
|
self.conf2.unauth = True
|
|
|
|
self.conf2.auth = True
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
|
|
|
# ... one on IPv6 with similar configuration
|
|
|
|
self.conf3 = Socks5Configuration()
|
|
|
|
self.conf3.af = socket.AF_INET6
|
2016-11-16 10:04:05 +01:00
|
|
|
self.conf3.addr = ('::1', RANGE_BEGIN + 2000 + (os.getpid() % 1000))
|
2016-02-09 12:37:05 +01:00
|
|
|
self.conf3.unauth = True
|
|
|
|
self.conf3.auth = True
|
|
|
|
else:
|
2017-03-19 10:13:45 +01:00
|
|
|
self.log.warning("Testing without local IPv6 support")
|
2015-04-17 19:26:03 +02:00
|
|
|
|
|
|
|
self.serv1 = Socks5Server(self.conf1)
|
|
|
|
self.serv1.start()
|
|
|
|
self.serv2 = Socks5Server(self.conf2)
|
|
|
|
self.serv2.start()
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
|
|
|
self.serv3 = Socks5Server(self.conf3)
|
|
|
|
self.serv3.start()
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2020-11-18 17:13:27 +01:00
|
|
|
# We will not try to connect to this.
|
|
|
|
self.i2p_sam = ('127.0.0.1', 7656)
|
|
|
|
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
# 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.
|
2016-02-09 12:37:05 +01:00
|
|
|
args = [
|
2020-07-29 03:23:12 +02:00
|
|
|
['-listen', '-proxy=%s:%i' % (self.conf1.addr),'-proxyrandomize=1'],
|
2020-11-18 17:13:27 +01:00
|
|
|
['-listen', '-proxy=%s:%i' % (self.conf1.addr),'-onion=%s:%i' % (self.conf2.addr),
|
|
|
|
'-i2psam=%s:%i' % (self.i2p_sam), '-i2pacceptincoming=0', '-proxyrandomize=0'],
|
2020-07-29 03:23:12 +02:00
|
|
|
['-listen', '-proxy=%s:%i' % (self.conf2.addr),'-proxyrandomize=1'],
|
2016-02-09 12:37:05 +01:00
|
|
|
[]
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
]
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
2017-03-09 21:16:20 +01:00
|
|
|
args[3] = ['-listen', '-proxy=[%s]:%i' % (self.conf3.addr),'-proxyrandomize=0', '-noonion']
|
2017-09-01 18:47:13 +02:00
|
|
|
self.add_nodes(self.num_nodes, extra_args=args)
|
|
|
|
self.start_nodes()
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2023-04-16 07:18:06 +02:00
|
|
|
def network_test(self, node, addr, network):
|
|
|
|
for peer in node.getpeerinfo():
|
|
|
|
if peer["addr"] == addr:
|
|
|
|
assert_equal(peer["network"], network)
|
|
|
|
|
2015-06-15 12:44:56 +02:00
|
|
|
def node_test(self, node, proxies, auth, test_onion=True):
|
2015-04-17 19:26:03 +02:00
|
|
|
rv = []
|
2023-04-16 07:18:06 +02:00
|
|
|
addr = "15.61.23.23:1234"
|
|
|
|
self.log.debug("Test: outgoing IPv4 connection through node for address {}".format(addr))
|
|
|
|
node.addnode(addr, "onetry")
|
2015-04-17 19:26:03 +02:00
|
|
|
cmd = proxies[0].queue.get()
|
2021-08-27 21:03:02 +02:00
|
|
|
assert isinstance(cmd, Socks5Command)
|
2020-06-11 10:39:04 +02:00
|
|
|
# Note: dashd's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
2015-04-17 19:26:03 +02:00
|
|
|
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
2016-04-10 16:54:28 +02:00
|
|
|
assert_equal(cmd.addr, b"15.61.23.23")
|
2015-04-17 19:26:03 +02:00
|
|
|
assert_equal(cmd.port, 1234)
|
|
|
|
if not auth:
|
|
|
|
assert_equal(cmd.username, None)
|
|
|
|
assert_equal(cmd.password, None)
|
|
|
|
rv.append(cmd)
|
2023-04-16 07:18:06 +02:00
|
|
|
self.network_test(node, addr, network=NET_IPV4)
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
2023-04-16 07:18:06 +02:00
|
|
|
addr = "[1233:3432:2434:2343:3234:2345:6546:4534]:5443"
|
|
|
|
self.log.debug("Test: outgoing IPv6 connection through node for address {}".format(addr))
|
|
|
|
node.addnode(addr, "onetry")
|
2016-02-09 12:37:05 +01:00
|
|
|
cmd = proxies[1].queue.get()
|
2021-08-27 21:03:02 +02:00
|
|
|
assert isinstance(cmd, Socks5Command)
|
2020-06-11 10:39:04 +02:00
|
|
|
# Note: dashd's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
2016-02-09 12:37:05 +01:00
|
|
|
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
|
|
|
assert_equal(cmd.addr, b"1233:3432:2434:2343:3234:2345:6546:4534")
|
|
|
|
assert_equal(cmd.port, 5443)
|
|
|
|
if not auth:
|
|
|
|
assert_equal(cmd.username, None)
|
|
|
|
assert_equal(cmd.password, None)
|
|
|
|
rv.append(cmd)
|
2023-04-16 07:18:06 +02:00
|
|
|
self.network_test(node, addr, network=NET_IPV6)
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2015-06-15 12:44:56 +02:00
|
|
|
if test_onion:
|
2023-09-20 13:01:53 +02:00
|
|
|
addr = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion:8333"
|
2023-04-16 07:18:06 +02:00
|
|
|
self.log.debug("Test: outgoing onion connection through node for address {}".format(addr))
|
|
|
|
node.addnode(addr, "onetry")
|
2015-06-15 12:44:56 +02:00
|
|
|
cmd = proxies[2].queue.get()
|
2021-08-27 21:03:02 +02:00
|
|
|
assert isinstance(cmd, Socks5Command)
|
2015-06-15 12:44:56 +02:00
|
|
|
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
2023-09-20 13:01:53 +02:00
|
|
|
assert_equal(cmd.addr, b"pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion")
|
2015-06-15 12:44:56 +02:00
|
|
|
assert_equal(cmd.port, 8333)
|
|
|
|
if not auth:
|
|
|
|
assert_equal(cmd.username, None)
|
|
|
|
assert_equal(cmd.password, None)
|
|
|
|
rv.append(cmd)
|
2023-04-16 07:18:06 +02:00
|
|
|
self.network_test(node, addr, network=NET_ONION)
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2023-04-16 07:18:06 +02:00
|
|
|
addr = "node.noumenon:8333"
|
|
|
|
self.log.debug("Test: outgoing DNS name connection through node for address {}".format(addr))
|
|
|
|
node.addnode(addr, "onetry")
|
2015-04-17 19:26:03 +02:00
|
|
|
cmd = proxies[3].queue.get()
|
2021-08-27 21:03:02 +02:00
|
|
|
assert isinstance(cmd, Socks5Command)
|
2015-04-17 19:26:03 +02:00
|
|
|
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
2016-04-10 16:54:28 +02:00
|
|
|
assert_equal(cmd.addr, b"node.noumenon")
|
2015-04-17 19:26:03 +02:00
|
|
|
assert_equal(cmd.port, 8333)
|
|
|
|
if not auth:
|
|
|
|
assert_equal(cmd.username, None)
|
|
|
|
assert_equal(cmd.password, None)
|
|
|
|
rv.append(cmd)
|
2023-04-16 07:18:06 +02:00
|
|
|
self.network_test(node, addr, network=NET_UNROUTABLE)
|
2015-04-17 19:26:03 +02:00
|
|
|
|
|
|
|
return rv
|
|
|
|
|
|
|
|
def run_test(self):
|
|
|
|
# basic -proxy
|
|
|
|
self.node_test(self.nodes[0], [self.serv1, self.serv1, self.serv1, self.serv1], False)
|
|
|
|
|
|
|
|
# -proxy plus -onion
|
|
|
|
self.node_test(self.nodes[1], [self.serv1, self.serv1, self.serv2, self.serv1], False)
|
|
|
|
|
|
|
|
# -proxy plus -onion, -proxyrandomize
|
|
|
|
rv = self.node_test(self.nodes[2], [self.serv2, self.serv2, self.serv2, self.serv2], True)
|
|
|
|
# Check that credentials as used for -proxyrandomize connections are unique
|
|
|
|
credentials = set((x.username,x.password) for x in rv)
|
2016-02-09 12:37:05 +01:00
|
|
|
assert_equal(len(credentials), len(rv))
|
2015-04-17 19:26:03 +02:00
|
|
|
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
|
|
|
# proxy on IPv6 localhost
|
|
|
|
self.node_test(self.nodes[3], [self.serv3, self.serv3, self.serv3, self.serv3], False, False)
|
2015-06-15 12:44:56 +02:00
|
|
|
|
|
|
|
def networks_dict(d):
|
|
|
|
r = {}
|
|
|
|
for x in d['networks']:
|
|
|
|
r[x['name']] = x
|
|
|
|
return r
|
|
|
|
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
self.log.info("Test RPC getnetworkinfo")
|
2015-06-15 12:44:56 +02:00
|
|
|
n0 = networks_dict(self.nodes[0].getnetworkinfo())
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
assert_equal(NETWORKS, n0.keys())
|
|
|
|
for net in NETWORKS:
|
2020-11-18 17:13:27 +01:00
|
|
|
if net == NET_I2P:
|
|
|
|
expected_proxy = ''
|
|
|
|
expected_randomize = False
|
|
|
|
else:
|
|
|
|
expected_proxy = '%s:%i' % (self.conf1.addr)
|
|
|
|
expected_randomize = True
|
|
|
|
assert_equal(n0[net]['proxy'], expected_proxy)
|
|
|
|
assert_equal(n0[net]['proxy_randomize_credentials'], expected_randomize)
|
2015-06-15 12:44:56 +02:00
|
|
|
assert_equal(n0['onion']['reachable'], True)
|
2020-11-18 17:13:27 +01:00
|
|
|
assert_equal(n0['i2p']['reachable'], False)
|
2015-06-15 12:44:56 +02:00
|
|
|
|
|
|
|
n1 = networks_dict(self.nodes[1].getnetworkinfo())
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
assert_equal(NETWORKS, n1.keys())
|
|
|
|
for net in ['ipv4', 'ipv6']:
|
2015-06-15 12:44:56 +02:00
|
|
|
assert_equal(n1[net]['proxy'], '%s:%i' % (self.conf1.addr))
|
|
|
|
assert_equal(n1[net]['proxy_randomize_credentials'], False)
|
|
|
|
assert_equal(n1['onion']['proxy'], '%s:%i' % (self.conf2.addr))
|
|
|
|
assert_equal(n1['onion']['proxy_randomize_credentials'], False)
|
|
|
|
assert_equal(n1['onion']['reachable'], True)
|
2020-11-18 17:13:27 +01:00
|
|
|
assert_equal(n1['i2p']['proxy'], '%s:%i' % (self.i2p_sam))
|
|
|
|
assert_equal(n1['i2p']['proxy_randomize_credentials'], False)
|
|
|
|
assert_equal(n1['i2p']['reachable'], True)
|
Merge #12987: tests/tools: Enable additional Python flake8 rules for automatic linting via Travis
643aad17fa Enable additional flake8 rules (practicalswift)
f020aca297 Minor Python cleanups to make flake8 pass with the new rules enabled (practicalswift)
Pull request description:
Enabled rules:
```
* E242: tab after ','
* E266: too many leading '#' for block comment
* E401: multiple imports on one line
* E402: module level import not at top of file
* E701: multiple statements on one line (colon)
* E901: SyntaxError: invalid syntax
* E902: TokenError: EOF in multi-line string
* F821: undefined name 'Foo'
* W293: blank line contains whitespace
* W606: 'async' and 'await' are reserved keywords starting with Python 3.7
```
Note to reviewers:
* In general we don't allow whitespace cleanups to existing code, but in order to allow for enabling Travis checking for these rules a few smaller whitespace cleanups had to made as part of this PR.
* Use [this `?w=1` link](https://github.com/bitcoin/bitcoin/pull/12987/files?w=1) to show a diff without whitespace changes.
Before this commit:
```
$ flake8 -qq --statistics --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W504,W601,W602,W603,W604,W605,W606 .
5 E266 too many leading '#' for block comment
4 E401 multiple imports on one line
6 E402 module level import not at top of file
5 E701 multiple statements on one line (colon)
1 F812 list comprehension redefines 'n' from line 159
4 F821 undefined name 'ConnectionRefusedError'
28 W293 blank line contains whitespace
```
After this commit:
```
$ flake8 -qq --statistics --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W504,W601,W602,W603,W604,W605,W606 .
$
```
Tree-SHA512: fc7d5e752298a50d4248afc620ee2c173135b4ca008e48e02913ac968e5a24a5fd5396926047ec62f1d580d537434ccae01f249bb2f3338fa59dc630bf97ca7a
Signed-off-by: pasta <pasta@dashboost.org>
2018-04-16 17:49:49 +02:00
|
|
|
|
2015-06-15 12:44:56 +02:00
|
|
|
n2 = networks_dict(self.nodes[2].getnetworkinfo())
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
assert_equal(NETWORKS, n2.keys())
|
|
|
|
for net in NETWORKS:
|
2020-11-18 17:13:27 +01:00
|
|
|
if net == NET_I2P:
|
|
|
|
expected_proxy = ''
|
|
|
|
expected_randomize = False
|
|
|
|
else:
|
|
|
|
expected_proxy = '%s:%i' % (self.conf2.addr)
|
|
|
|
expected_randomize = True
|
|
|
|
assert_equal(n2[net]['proxy'], expected_proxy)
|
|
|
|
assert_equal(n2[net]['proxy_randomize_credentials'], expected_randomize)
|
2015-06-15 12:44:56 +02:00
|
|
|
assert_equal(n2['onion']['reachable'], True)
|
2020-11-18 17:13:27 +01:00
|
|
|
assert_equal(n2['i2p']['reachable'], False)
|
2015-06-15 12:44:56 +02:00
|
|
|
|
2016-02-09 12:37:05 +01:00
|
|
|
if self.have_ipv6:
|
|
|
|
n3 = networks_dict(self.nodes[3].getnetworkinfo())
|
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
2020-11-09 17:03:37 +01:00
|
|
|
assert_equal(NETWORKS, n3.keys())
|
|
|
|
for net in NETWORKS:
|
2020-11-18 17:13:27 +01:00
|
|
|
if net == NET_I2P:
|
|
|
|
expected_proxy = ''
|
|
|
|
else:
|
|
|
|
expected_proxy = '[%s]:%i' % (self.conf3.addr)
|
|
|
|
assert_equal(n3[net]['proxy'], expected_proxy)
|
2016-02-09 12:37:05 +01:00
|
|
|
assert_equal(n3[net]['proxy_randomize_credentials'], False)
|
|
|
|
assert_equal(n3['onion']['reachable'], False)
|
2020-11-18 17:13:27 +01:00
|
|
|
assert_equal(n3['i2p']['reachable'], False)
|
2015-06-15 12:44:56 +02:00
|
|
|
|
2023-04-16 07:18:06 +02:00
|
|
|
|
2015-04-17 19:26:03 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
ProxyTest().main()
|