WIP: Add version protocol in hello handshakes and add country in addresses
We recently discovered that the ip geolocation database present for each re6st node doesn't match the correct country for some IP's. This implies problems when using the --same-country
option.
To solve this, the country associated to an IP can be added to the (ip, port, protocol) address tuple which nodes exchange between themselves in order to allow tunnel creations. We can then add a --country
option allowing nodes to advertise the country they want, thus bypassing our current ip geolocation methods.
However, we need to ensure nodes who won't immediately update will still be able to make tunnels and communicate with other re6st nodes.
In order to ease compatibility between different re6st inter-node or node-registry protocols, nodes and registries should know the protocol of the peer they are communicating with as early as possible. For inter-node communication, I added the protocol in seqno 1 and seqno 2 (since seqno 0 can be skipped), and for node-registry communication, I added the protocol as an optional argument to the hello RPC.
This means a handhsake initiated from an old node to a new node will fail. To ease tunnel creation, I prevent the registry from sending countries to old nodes during bootstrapping. One drawback is that unwanted tunnels which break the --same-country
rule may be created during bootstrapping.
/cc @tomo @jm