n0-computer/iroh ? reverse-engineered prompt

Reverse engineered prompt

Build me a Rust library for peer to peer connections where apps can connect to another device by a public key instead of an IP address.

It should try to make a direct connection first, use hole punching when needed, and fall back to a relay if direct connection fails. I want it to keep the fastest working connection alive automatically, and use secure QUIC connections with bidirectional streams and datagrams.

Please include a simple example showing two peers connecting and sending a hello world message, plus a small router style API for handling incoming connections. If it makes sense, also add support for a DNS style lookup for endpoint IDs and a basic relay client and server setup.

Use current docs online if you need to, and make it feel production ready, with clear errors and a clean Rust API.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab