Hacker News new | ask | show | jobs
by captain_dfx 31 days 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

Happy to get into the addressing scheme, the iroh transport, the admission and coordinator model, or anything else.

8 comments

With 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.

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.

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
If you have any previous experience in this domain and/or other relevant credentials it would help to mention them here as well.
Yeah 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
Because 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.

I think it's too much. I don't feel like I need to justify myself. You can read the code.

But anyways, first of all; you can see we run a trading company called Infinite Field (https://github.com/infinitefield) and we trade on a decentralized venue called Hyperliquid. You can check the leaderboard there, we are in the top 15 or so. We are doing more than just trading there, we also run a validator with 0 revenue on our side. We charge no fees. Although maintenance cost is high (20k/month). We also built an SDK for users building in Hyperliquid because the official one was not good enough (https://github.com/infinitefield/hypersdk). No other market maker is going to do that. Mostly. Also, I built and released our in-house websocket library (https://github.com/infinitefield/yawc) because I consider it to be better than tokio-websockets or tungstenite. Why is it better? It supports compression (which no other does) and WASM (that one was pre-LLMs so code is mine alone hehe).

> 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?

I am always busy. But I want to deliver a minimum set of features that will work without me. You can see the open issues and PRs. All of the work is being made transparently on Github. I also use the product myself and I hope I can use it internally at my company too. If you want to reach out to me you can do it over email or telegram (ask for it) and I am 24/7 online. When I say the idea was sitting idle for 4 years; it basically means I was a guy from a town in Spain and I had to do something to get out of there. Although I contributed a lot to opensource when I was younger (check https://github.com/dgrr) it didn't pay the bills! So it took me 4 years to reach a level in which I feel comfortable dedicating some time to opensource stuff like hypersdk, yawc or now rayfish (actually more than 4 years, but rayfish was there for that amount of time).

I am very transparent. I'll open up my X account so you can engage more directly with me if you want.

It'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.

Ah 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?

Please 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?
If you dont like the use of AI dont use it. Very simple. I went from idea (4 years ago) to implementation in 2 weeks.
> 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.

> Happy to get into ...

No reply to various questions an hour later. I guess they're not really watching.

I'm sure any moment now the next openclaw heartbeat will fire.
When the wise man points to the moon, the fool looks at the finger
They can be spotted a mile away. Check the repo - 2 weeks to complete!
bro ditched the car to use the horse
Part of the n0/iroh team, cool to see this here, looking forward to play with it :)
Hey, 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?
I 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.
Great 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!
Thank you. I am working on the android app right now
could 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