mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 02:21:36 +00:00
expose client.peerId
and client.peerIdBuffer
This commit is contained in:
parent
7980e264da
commit
177171b82c
@ -34,11 +34,11 @@ function Client (peerId, port, torrent, opts) {
|
||||
if (!opts) opts = {}
|
||||
|
||||
// required
|
||||
self._peerId = Buffer.isBuffer(peerId)
|
||||
self.peerId = typeof peerId === 'string'
|
||||
? peerId
|
||||
: new Buffer(peerId, 'hex')
|
||||
self._peerIdHex = self._peerId.toString('hex')
|
||||
self._peerIdBinary = self._peerId.toString('binary')
|
||||
: peerId.toString('hex')
|
||||
self.peerIdBuffer = new Buffer(self.peerId, 'hex')
|
||||
self._peerIdBinary = self.peerIdBuffer.toString('binary')
|
||||
|
||||
self.infoHash = typeof torrent.infoHash === 'string'
|
||||
? torrent.infoHash
|
||||
|
@ -194,7 +194,7 @@ UDPTracker.prototype._request = function (opts) {
|
||||
common.toUInt32(common.ACTIONS.ANNOUNCE),
|
||||
transactionId,
|
||||
self.client.infoHashBuffer,
|
||||
self.client._peerId,
|
||||
self.client.peerIdBuffer,
|
||||
toUInt64(opts.downloaded),
|
||||
opts.left != null ? toUInt64(opts.left) : new Buffer('FFFFFFFFFFFFFFFF', 'hex'),
|
||||
toUInt64(opts.uploaded),
|
||||
|
Loading…
Reference in New Issue
Block a user