bittorrent-relay
Advanced tools
Comparing version 8.0.2 to 8.0.3
{ | ||
"name": "bittorrent-relay", | ||
"description": "Uses the mainline dht to relay requests to other trackers in a swarm", | ||
"version": "8.0.2", | ||
"version": "8.0.3", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "bittorrent-relay": "./bin/cmd.js" |
@@ -1034,3 +1034,4 @@ import Debug from 'debug' | ||
peer_id: hex2bin(params.peer_id), | ||
info_hash: hex2bin(params.info_hash) | ||
info_hash: hex2bin(params.info_hash), | ||
public_key: params.public_key | ||
}), peer.socket.onSend) | ||
@@ -1068,3 +1069,4 @@ debug('sent offer to %s from %s', peer.peerId, params.peer_id) | ||
peer_id: hex2bin(params.peer_id), | ||
info_hash: hex2bin(params.info_hash) | ||
info_hash: hex2bin(params.info_hash), | ||
public_key: params.public_key | ||
}), toPeer.socket.onSend) | ||
@@ -1071,0 +1073,0 @@ debug('sent answer to %s from %s', toPeer.peerId, params.peer_id) |
import { bin2hex } from 'uint8-util' | ||
import crypto from 'crypto' | ||
@@ -24,2 +25,8 @@ import common from '../lib/common.js' | ||
if(params.public_key){ | ||
if(crypto.createHash('sha1').update(params.public_key).digest('hex') !== params.peer_id){ | ||
throw new Error('public_key must be SHA1 hash of peer_id') | ||
} | ||
} | ||
if (params.answer) { | ||
@@ -26,0 +33,0 @@ if (typeof params.to_peer_id !== 'string' || params.to_peer_id.length !== 20) { |
100292
2718