This commit is contained in:
Feross Aboukhadijeh 2018-02-17 17:13:56 -08:00
parent dec3f13165
commit fc87c8c9ff
3 changed files with 5 additions and 5 deletions

View File

@ -11,8 +11,8 @@ var whitelist = {
var server = new Server({
http: false, // we do our own
udp: false, // not interested
ws: false, // not interested
udp: false, // not interested
ws: false, // not interested
filter: function (params) {
// black/whitelist for disallowing/allowing specific clients [default=allow all]
// this example only allows the uTorrent client

View File

@ -56,8 +56,8 @@ function parseWebSocketRequest (socket, opts, params) {
// to reduce memory usage.
if (socket.upgradeReq) {
socket.ip = opts.trustProxy
? socket.upgradeReq.headers['x-forwarded-for'] || socket.upgradeReq.connection.remoteAddress
: socket.upgradeReq.connection.remoteAddress.replace(common.REMOVE_IPV4_MAPPED_IPV6_RE, '') // force ipv4
? socket.upgradeReq.headers['x-forwarded-for'] || socket.upgradeReq.connection.remoteAddress
: socket.upgradeReq.connection.remoteAddress.replace(common.REMOVE_IPV4_MAPPED_IPV6_RE, '') // force ipv4
socket.port = socket.upgradeReq.connection.remotePort
if (socket.port) {
socket.addr = (common.IPV6_RE.test(socket.ip) ? '[' + socket.ip + ']' : socket.ip) + ':' + socket.port

View File

@ -403,7 +403,7 @@ Server.prototype.onHttpRequest = function (req, res, opts) {
}
if (self.destroyed) return res.end()
delete response.action // only needed for UDP encoding
delete response.action // only needed for UDP encoding
res.end(bencode.encode(response))
if (params.action === common.ACTIONS.ANNOUNCE) {