Any plans to implement new bittorrent enhancement titled "Canonical Peer Priority"? which connects to geographically closer peers?
Hey @norzak,
Just to make it easier for others, the BEP referenced is BEP40.
This seems like it could possibly be implemented within the ._drain function of the TCPOutgoingPeer queue _queue within torrent.js, prioritising the draining order based on priority calculated via the formula outlined in BEP40.
We would also need a way to determine the clients ip address as I don't believe we currently have a way.
I would love for somebody to double check this to make sure I'm not missing something.
Hi @SilentBot1,
On the webtorrent.io page, during streaming video from the peers, I see some IP addresses connecting to mine in a visual animation. Where are those IPs coming from?
Hey @norzak,
After digging into it, if the peer is added via ip:port (so not a WebRTC peer) then this is just split and added to the wire object, if the peer is added via WebRTC offer the information is pulled from the offer.
After poking into the WebRTC offers a bit, it exposes both the local and remote ip address so that would make calculating the formula quite easy. The only issue I see with WebRTC is there is no queue, offers are responded to the instant they are received unlike TCP which has a queue of peers.
As for standard TCP peers, a package like public-ip would likely need to be used to discover the servers external IP when opearting behind a NAT to allow for calculation of the formula, though this wouldn't be needed if the torrent was operating locally within a LAN.
Most of this is me just writing down my thoughts, so any second opinions would be appreciated.
This feature seems interesting, but not high priority. We're already one of the fastest torrent clients out there. I'm skeptical that we need to prioritize based on geographic location when the torrent protocol already prioritizes peers which upload the fastest.
The DDOS protection features seem interesting, though, so I've re-opened this issue.
I don't believe that BEP40 has anything to do with geographic location. Here's a good article about why it exists https://blog.libtorrent.org/2012/12/swarm-connectivity/
For WebRTC peers, I think this would have to be implemented in the tracker to have any benefit (because I don't think clients can choose which WebRTC peers to connect to, they just ask the tracker for one).
@KayleePop Thanks for the link. I agree we should implement this! At least for TCP/uTP connections. Eventually, we can see about redesigning the WebTorrent tracker protocol to include a way for peers to get IP info before deciding to connect.
Most helpful comment
I don't believe that BEP40 has anything to do with geographic location. Here's a good article about why it exists https://blog.libtorrent.org/2012/12/swarm-connectivity/
For WebRTC peers, I think this would have to be implemented in the tracker to have any benefit (because I don't think clients can choose which WebRTC peers to connect to, they just ask the tracker for one).