4 ms·
Hi HN, we built Rayfish, a peer-to-peer mesh VPN written in Rust on top of iroh. The core idea: every node has a keypair, and its identity on the network is th
by captain_dfx 3mo ago
Hi HN, we built Rayfish, a peer-to-peer mesh VPN written in Rust on top of iroh.
The core idea: every node has a keypair, and its identity on the network is that public key. From the key we derive a stable IPv4 in 100.64.0.0/10 and a stable IPv6 in 200::/7, similar in spirit to yggdrasil. Those addresses are yours for as long as you hold the key, and they don't change when you move networks or your physical IP changes. You still reach peers by IP or by a name.ray DNS name, the difference is that the address comes from the identity rather than from where you happen to be.
"No server to trust" is the part we care about most. There is no central control plane that brokers your traffic or holds the keys to your network. Peers find each other and connect directly over iroh's QUIC stack, with NAT traversal, hole punching, and relay fallback handled underneath. Relays, when used, only forward encrypted packets and never see your keys or decide who is in your network. Membership and trust live with the peers, not with us.
How it works in practice:
- Networks are closed by default. You join with a one-time invite, a reusable key for fleets of servers, or live approval from a member already inside. The room id is only for discovery, it is never an admission credential.
- Any member can be granted the network key and act as a coordinator, so admitting new peers keeps working even if the original creator is offline.
- There is a per-device firewall, directional and scoped by port and protocol, plus Magic DNS so you can reach nodes at name.ray (or just name, no need for the .ray suffix).
- A "ray connect" flow links two people directly with no shared room, like a friend request between keys.
- No ACLs. Networks are logical partitions. Firewall is per-host. You can combine both to have custom ACLs.
It is a single binary with a daemon and a CLI. `ray up`, then `ray create` or `ray join <invite>`, and you have a private network.
Honest limitations: it is early. The mesh protocol is gated at the transport layer, so we break compatibility between releases when we need to. There has been no third-party security audit yet. Mobile is not there. It runs on Linux and macOS today.
Code: https://github.com/rayfish/rayfish https://github.com/rayfish/rayfish
Happy to get into the addressing scheme, the iroh transport, the admission and coordinator model, or anything else.
- Retr0id 3mo agoWith IPv6 it's plausible that you can avoid collisions as long as you use an expensive hash function, but for v4 how do you avoid IP collisions? With only 22 bits of entropy in your v4 addresses, you'll get accidental collisions with only ~2000 users.
- dfish 3mo agoIndeed. 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.
- Retr0id 3mo agoSo I'd have a different IP on each network? (I really hope "private key" was a typo of "public key"?)
- dfish 3mo agoIndeed, 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.
- tom1337890 3mo agoGreat work. I'm currently using tailscale and would love to have another option! Hosting my own iroh-relay makes it truely independent then. Only missing the mobile app now! Keep up the good work!
- dfish 3mo agoThank you. I am working on the android app right now
- sillyfluke 3mo agoIf you have any previous experience in this domain and/or other relevant credentials it would help to mention them here as well.
- dfish 3mo agoYeah I run an HFT firm. Apart from that, why does it matter? This isn't finance! But of course, rayfish is NOT production ready. For home servers might be ok. BUT NOT PRODUCTION READY
- sillyfluke 3mo agoIt's the attention economy. You're engaging in something that is related to privacy and security, thus the credibility of the author in this domain will also be a factor for people wanting to invest their time exploring these solutions. To not care who you are would mean not only having to review the current code as is, but to review every update that follows as possibly written by a hostile party. Ie, the time invested would be several times of that invested in something written by a more trusted party.
- dfish 3mo agoAh I understand that. Good thing is you dont need to trust me! You can just read the code. And PRs are welcome, and over time more maintainers. You can also fork it. It has MPL-2.0 license to ensure code is always open. In terms of the credentials; again, it is not a product like Bitcoin. I am not a researcher from some university. I don't even have a computer science degree. So I don't oblige to "credentials". I am an entrepreneur, I had some ideas. One of those ideas is rayfish. I like to give back to groups or people. I live in a country where I pay no taxes so I can donate part of that to cat shelters from my homecountry and in this case I open-sourced rayfish because I think it is a good product many people like me will enjoy. Does that reply to your concerns?
- rsyring 3mo agoBecause it's security related, the trust needed to consider using it is just higher. Trust at two levels: who are you? What HFT firm do you run? How do we know you are actually this HFT leader? What are you doing in the HFT firm that lends credibility to build a project like this? I.e. if you lead the sales team, and have no software dev background, it doesn't increase trust in this project. If you built all the software for the HFT firm, that matters. Since it's security related, we want there to be signals in the project that we can trust it to not start sending all our data to some bad actor state or org. Then there is trust at the code level... Does it work? Will it continue to work? You built it in two weeks because, for the last four years, you were busy with other things. If you get busy again, will the project lag for the next four years? You don't owe us any of these answers. It's OSS, engage at whatever level you want. But, understand that when you publish your efforts to a place like HN, we are going to find and mention the things that make us uncomfortable. That said, it's a good sign that people are pushing back. It is a cool project and fits a real need. So if you can increase the trust signals in the project, I think you will get more users... If you really want them. More users means more critique. :) I hope you do make an effort to increase the trust signals and keep working on the project because I'd like to use it.
- applfanboysbgon 3mo ago> Honest [...] > Happy to get into the addressing scheme I truly loathe how all of the HN spambots promoting shovelware include a stupid call-to-action for feedback/discussion.
- aftbit 3mo ago> Happy to get into ... No reply to various questions an hour later. I guess they're not really watching.
- Retr0id 3mo agoI'm sure any moment now the next openclaw heartbeat will fire.
- keepupnow 3mo agoThey can be spotted a mile away. Check the repo - 2 weeks to complete!
- deleted 3mo ago[deleted]
- dfish 3mo agobro ditched the car to use the horse
- dfish 3mo agoWhen the wise man points to the moon, the fool looks at the finger
- mac-monet 3mo agoHey, thanks for sharing this, this is a very cool project and one that is the obvious next step with iroh. I'm curious if you plan to make it into a library to be used, or you intend to keep it solely as an application?
- dfish 3mo agoI did gauge that possibility. But iroh is already the library doing the heavy-lifting. So no, I don't think I'll make it a library. It is actually kinda a library now that I have to add android support. But it's not really fit to be a library.
- zuzululu 3mo agocould a MITM/poison-well attacks work here or susceptible ? im also afraid of exploits disseminating from a mesh network it would be impossible to stop great work
- keepupnow 3mo agoPlease disclose your use of AI. It's rather telling 2 weeks from repository commencement to release. Why should anyone use this over other products, and what testing have you done to PROVE it works as explained by your LLM?
- dfish 3mo agoIf you dont like the use of AI dont use it. Very simple. I went from idea (4 years ago) to implementation in 2 weeks.
- Arqu 3mo agoPart of the n0/iroh team, cool to see this here, looking forward to play with it :)