diff options
author | Julen Garcia Leunda <hicom150@gmail.com> | 2020-10-27 01:48:14 +0300 |
---|---|---|
committer | Julen Garcia Leunda <hicom150@gmail.com> | 2020-10-30 14:53:37 +0300 |
commit | 271bb563a76b32fcc891c4f7084063ad1dd42ef4 (patch) | |
tree | 05738f4a73cc9f403c986e6bb141d4d123064d20 /lib/torrent.js | |
parent | 666c27865d179278716f6a3eceebf3003bacd028 (diff) |
Implement peer-address (x.pe) BEP09
Diffstat (limited to 'lib/torrent.js')
-rw-r--r-- | lib/torrent.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 7b79e15..aa46009 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -322,6 +322,13 @@ class Torrent extends EventEmitter { }) } + // add BEP09 peer-address + // TODO: It should only be included if the client can discover its public IP address and determine its reachability. + if (this.peerAddress) { + const peers = Array.isArray(this.peerAddress) ? this.peerAddress : [this.peerAddress] + peers.forEach(peer => this.addPeer(peer)) + } + // begin discovering peers via DHT and trackers this.discovery = new Discovery({ infoHash: this.infoHash, |