hyperswarm / discovery

The Hyperswarm discovery stack
MIT License
121 stars 16 forks source link

Allow additional data as part of announce #17

Open KrishnaPG opened 4 years ago

KrishnaPG commented 4 years ago

Could you please accept additional user-data as part of the announcement API (and add that user-supplied data to the built-in lookup data and put it on the DHT)?

For example, along with peer host, port, would like to have publicKey, compression, P2P offers etc. all part of the announcement, so that discovered peers can be connected correctly. This also facilitates ICE like features, as the P2P connection offers can be retrieved from the discovery results.

IP is just one network layout option. Announcer might want to offer multiple connection facilities, and currently, @hyperswarm/discovery and DHT seems to be hardcoding the DHT lookup values to be {host, port} (essentially IPV4), which is too restrictive. Allowing custom values to be added to the announcer record in the DHT allows, say, p2p peer ids, IPV6 records, Proxy info, STUN offers, publicKeys etc. to be supplied by the user if needed, making it possible for the clients to take the best possible connection option and connect the right way.

mafintosh commented 4 years ago

The DHT has built in STUN.

No plans to change the announce message atm, but could be tweaked in the future.