Open cinnamon-bun opened 3 years ago
Hello, some friendly feedback about improving the docs for this module <3
It gives you the ip addresses of peers and holepunches to them? Meaning you get a stream to each peer?
Docs say
// emitted when a peer is found lookup.on('peer', console.log)
...but what's in a peer object? What can it do?
I think this is the answer? https://github.com/hyperswarm/discovery/blob/master/index.js#L389
topic.emit('peer', { port: a.data.port, host, local: true, referrer: null, topic: topic.key })
So a peer is mostly a port and hostname, not a stream.
holepunch
Docs just say:
d.holepunch(peer, cb) UDP holepunch to another peer.
What actually happens? What does the callback get?
Looking in the code, it just calls dht.holepunch. The docs for hyperswarm/dht just say
dht.holepunch
node.holepunch(peer, [callback]) UDP holepunch to another peer. peer should be a { host, port, referrer: { host, port } }, where referrer should be the host and port of the DHT node who told you about this peer.
node.holepunch(peer, [callback])
UDP holepunch to another peer.
peer should be a { host, port, referrer: { host, port } }, where referrer should be the host and port of the DHT node who told you about this peer.
Ok, so that's probably the peer object we were talking about earlier. But what does this do, and what's provided to the callback?
The word holepunch does not occur in any of the code in hyperswarm/dht so I can't find what it's actually doing.
hyperswarm/dht
hi, there's a perfect explanation for you in this video about Hole Punching. https://youtu.be/1qzDiAg4VGk?t=674
Hello, some friendly feedback about improving the docs for this module <3
What's the scope of this module?
It gives you the ip addresses of peers and holepunches to them? Meaning you get a stream to each peer?
What's a peer object?
Docs say
...but what's in a peer object? What can it do?
I think this is the answer? https://github.com/hyperswarm/discovery/blob/master/index.js#L389
So a peer is mostly a port and hostname, not a stream.
What does
holepunch
do?Docs just say:
What actually happens? What does the callback get?
Looking in the code, it just calls
dht.holepunch
. The docs for hyperswarm/dht just sayOk, so that's probably the peer object we were talking about earlier. But what does this do, and what's provided to the callback?
The word
holepunch
does not occur in any of the code inhyperswarm/dht
so I can't find what it's actually doing.