feat: Add support for both ip and hostname for peers#3432
feat: Add support for both ip and hostname for peers#3432Raphexion wants to merge 1 commit intoProvableHQ:stagingfrom
Conversation
21a4598 to
eee4dc7
Compare
5c0cb10 to
126b444
Compare
126b444 to
5b9c8b4
Compare
| let trimmed = ip_or_hostname.trim(); | ||
| match trimmed.to_socket_addrs() { | ||
| Ok(mut ip_iter) => { | ||
| // A hostname might resolve to multiple IP addresses. We will use only the first one, |
There was a problem hiding this comment.
To avoid any surprises for node operators, is there any known syntax for selecting a particular index? Should we invent our own, e.g. hostname:port:1
There was a problem hiding this comment.
An alternative solution would be to enforce that only one IP is expected and allowed. So if there are more than one IP found, then we will print a warning and ignore the hostname.
The main idea behind this feature is to allow for a more flexible setup during tests. And in those cases, we can make sure that there is only one "validator-1" and only one "client-42". So I think it is a good trade-off, to enforce that only one IP is expected and found.
|
Though its a small and useful change, let's make sure there's buy-in and awareness from all dev orgs that the nodes now also rely on DNS, incurring a small new privacy and security risk. Also worth looking at geth's recent addition, which apparently also picks the first ip if multiple are defined. :) ethereum/go-ethereum#18524 |
|
@vicsn I agree 💯 , we should make sure that this feature is wanted and accepted 👍 And great link to geth 🙏 ☀️ |
It is convinent to be able to specify both IPs and hostnames as peers. Especially, when you are building ephemeral testnets and want to specify peers as ``` ./snarkos start --peers "validator0:4130,client0:4130" ``` Where you can populate the `/etc/hosts` file with subnet hostnames.
5b9c8b4 to
961ed42
Compare
Motivation
It is convinent to be able to specify both IPs and hostnames as peers. Especially, when you are building ephemeral testnets and want to specify peers as
Where you can populate the
/etc/hostsfile with subnet hostnames.Test Plan
Added unit-tests but can be tested on the commandline
Related PRs
None.