Hacker News new | ask | show | jobs
by dfish 24 days ago
Indeed. So what we do is build your ipv4 using private key bits + collision_index. It is not perfect but it has worked in our tests. We'll keep improving it.

The collision_index is incremented when a collision happens on a network. Let's say you join network A, B, C. But when you join C, another peer has the same IP. The coordinator (which is a role anybody can have in the network) will not accept you in the network unless you change your IP. Which means you need to increase your collision index. Now that process is repeated N times until you don't collide with any other peer.

1 comments

So I'd have a different IP on each network?

(I really hope "private key" was a typo of "public key"?)

Indeed, it is a typo of `public key`. What I mean is that your identity is your private key. And no, you won't have a new IP per network. Your IP is `fnv1a(ip || index) when index > 0`. Which changes your IP in all of the networks. That's why we also implemented MagicDNS. You can just use your `user.ray` name. The daemon handles IP changes.
So every time you join a new network, your IP in the others can change?
No, only once if there is a collision, which is 1/4M
That's a "yes"
> So I'd have a different IP on each network?

NO. You will ONLY have to rotate your IP if you join a network in which there is a collision. 1 in 4 million chance. If that happens, it's ok. Ideally you are using magicDNS and don't have to worry about IPs or just use the IPv6.