santaklouse/go-p2p-netcat ? reverse-engineered prompt
Reverse engineered prompt
Build me a Go app that works like netcat, but instead of connecting to an IP address it connects to another peer by PeerId.
I want a command line tool that can send data both ways, support a few ways of connecting like TCP, QUIC, WebSocket, and WebRTC, and keep a persistent identity so the same peer can be recognized again later. It should also support things like relays, peer discovery, pairing tokens, and a safe handshake before any real data is exposed.
Please include the usual netcat style options for listening, connecting, timeouts, proxy style forwarding, and raw stdin stdout use, plus support for PTY sessions and UDP forwarding too. It should also work in the browser with a simple web app so people can connect from a page, and the browser and CLI should be able to talk to each other.
If you need to check current libp2p or WebRTC docs while building it, go ahead and look them up online.