This repository was archived by the owner on Jun 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -111,13 +111,14 @@ var Server = require('bittorrent-tracker').Server
111111var server = new Server ({
112112 udp: true , // enable udp server? [default=true]
113113 http: true , // enable http server? [default=true]
114- filter : function (params ) {
114+ filter : function (infoHash , params ) {
115115 // black/whitelist for disallowing/allowing torrents [default=allow all]
116116 // this example only allows this one torrent
117- return params . info_hash === ' aaa67059ed6bd08362da625b3ae77f6f4a075aaa'
118-
117+ return infoHash === ' aaa67059ed6bd08362da625b3ae77f6f4a075aaa'
118+
119119 // you can also block by peer id (whitelisting torrent clients) or by
120- // secret key, as you get full access to the original http request
120+ // secret key, as you get full access to the original http GET
121+ // request parameters in `params`
121122 })
122123})
123124
Original file line number Diff line number Diff line change @@ -111,8 +111,9 @@ Server.prototype.close = function (cb) {
111111
112112Server . prototype . getSwarm = function ( infoHash , params ) {
113113 var self = this
114- if ( Buffer . isBuffer ( infoHash ) ) infoHash = params . info_hash = infoHash . toString ( 'hex' )
115- if ( self . _filter && ! self . _filter ( params ) ) return null
114+ if ( ! params ) params = { }
115+ if ( Buffer . isBuffer ( infoHash ) ) infoHash = infoHash . toString ( 'hex' )
116+ if ( self . _filter && ! self . _filter ( infoHash , params ) ) return null
116117 var swarm = self . torrents [ infoHash ]
117118 if ( ! swarm ) swarm = self . torrents [ infoHash ] = new Swarm ( infoHash , this )
118119 return swarm
You can’t perform that action at this time.
0 commit comments