threefoldtecharchive / rivine

Blockchain technology for creating custom chains.
Apache License 2.0
22 stars 12 forks source link

Implement link local service discovey in gateway #518

Closed LeeSmet closed 5 years ago

LeeSmet commented 5 years ago

Right now we have scenarios (e.g. our datacenter) where multiple daemons operate on the same external IP. Since these nodes all try to connect to the same nodes, they effectively are stealing each others connections. This causes some strange behavior, and in the end only one node is actually connected, while the others only THINK they are connected. In turn, these nodes are then mining on their own individual forks. This problem is mostly specific for IPv4, due to NAT setups. To (partially) alleviate this problem (without converting entire network to IPv6, which would likely also solve the problem), we can implement link local service discovery, allowing nodes on the same link/network to automatically discover eachother, and connect. Even if a single node has an outbound connection, it will act as a gateway for the local nodes (which are then connected to this one somehow), and the external world, allowing these nodes to be useful again. While implementing this, we want to ensure that: we connect on the local nodes, and, that we still actively try to connect to non local nodes, to avoid creating a network split if too many local nodes are present. To this extent, it might be best to keep track of nodes we found locally and keep them separated from the regulary found nodes in the gateway protocol.

Usefull starting point: https://github.com/dmichael/go-multicast/tree/master/multicast

LeeSmet commented 5 years ago

Duplicated by #604