mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 02:46:29 +00:00
build
This commit is contained in:
parent
dec3f13165
commit
fc87c8c9ff
@ -11,8 +11,8 @@ var whitelist = {
|
|||||||
|
|
||||||
var server = new Server({
|
var server = new Server({
|
||||||
http: false, // we do our own
|
http: false, // we do our own
|
||||||
udp: false, // not interested
|
udp: false, // not interested
|
||||||
ws: false, // not interested
|
ws: false, // not interested
|
||||||
filter: function (params) {
|
filter: function (params) {
|
||||||
// black/whitelist for disallowing/allowing specific clients [default=allow all]
|
// black/whitelist for disallowing/allowing specific clients [default=allow all]
|
||||||
// this example only allows the uTorrent client
|
// this example only allows the uTorrent client
|
||||||
|
@ -56,8 +56,8 @@ function parseWebSocketRequest (socket, opts, params) {
|
|||||||
// to reduce memory usage.
|
// to reduce memory usage.
|
||||||
if (socket.upgradeReq) {
|
if (socket.upgradeReq) {
|
||||||
socket.ip = opts.trustProxy
|
socket.ip = opts.trustProxy
|
||||||
? socket.upgradeReq.headers['x-forwarded-for'] || socket.upgradeReq.connection.remoteAddress
|
? 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.connection.remoteAddress.replace(common.REMOVE_IPV4_MAPPED_IPV6_RE, '') // force ipv4
|
||||||
socket.port = socket.upgradeReq.connection.remotePort
|
socket.port = socket.upgradeReq.connection.remotePort
|
||||||
if (socket.port) {
|
if (socket.port) {
|
||||||
socket.addr = (common.IPV6_RE.test(socket.ip) ? '[' + socket.ip + ']' : socket.ip) + ':' + socket.port
|
socket.addr = (common.IPV6_RE.test(socket.ip) ? '[' + socket.ip + ']' : socket.ip) + ':' + socket.port
|
||||||
|
@ -403,7 +403,7 @@ Server.prototype.onHttpRequest = function (req, res, opts) {
|
|||||||
}
|
}
|
||||||
if (self.destroyed) return res.end()
|
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))
|
res.end(bencode.encode(response))
|
||||||
|
|
||||||
if (params.action === common.ACTIONS.ANNOUNCE) {
|
if (params.action === common.ACTIONS.ANNOUNCE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user