holepunchto / hyperdht

The DHT powering Hyperswarm
https://docs.holepunch.to
MIT License
323 stars 46 forks source link

Add userData to handshake #57

Open pfrazee opened 2 years ago

pfrazee commented 2 years ago

Maf mentioned the potential to include userData in the handshake. I'd personally like to use that to declare the intended protocol so that I don't have to go sniffing packets.

lanmower commented 2 years ago

Me likey

OzymandiasTheGreat commented 2 years ago

I've been hacking on the DHT and this seems simple enough to do. One question tho @mafintosh where should userData be set? I think it'd be a good idea to set it on the server constructor and connect() call, that way we can have e.g. custom firewall logic based on userData. If you clarify this, I'll make a PR.