mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
restructure folders
This commit is contained in:
parent
2dc56de223
commit
3746c05d79
@ -8,9 +8,9 @@ var parallel = require('run-parallel')
|
||||
var url = require('url')
|
||||
|
||||
var common = require('./lib/common')
|
||||
var HTTPTracker = require('./lib/http-tracker') // empty object in browser
|
||||
var UDPTracker = require('./lib/udp-tracker') // empty object in browser
|
||||
var WebSocketTracker = require('./lib/websocket-tracker')
|
||||
var HTTPTracker = require('./lib/client/http-tracker') // empty object in browser
|
||||
var UDPTracker = require('./lib/client/udp-tracker') // empty object in browser
|
||||
var WebSocketTracker = require('./lib/client/websocket-tracker')
|
||||
|
||||
inherits(Client, EventEmitter)
|
||||
|
||||
|
@ -7,7 +7,7 @@ var EventEmitter = require('events').EventEmitter
|
||||
var get = require('simple-get')
|
||||
var inherits = require('inherits')
|
||||
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
var HTTP_SCRAPE_SUPPORT = /\/(announce)[^\/]*$/
|
||||
|
||||
@ -84,9 +84,9 @@ HTTPTracker.prototype.scrape = function (opts) {
|
||||
// TODO: Improve this interface
|
||||
HTTPTracker.prototype.setInterval = function (intervalMs) {
|
||||
var self = this
|
||||
self._intervalMs = intervalMs
|
||||
clearInterval(self._interval)
|
||||
|
||||
self._intervalMs = intervalMs
|
||||
if (intervalMs) {
|
||||
// HACK
|
||||
var update = self.announce.bind(self, self.client._defaultAnnounceOpts())
|
@ -9,7 +9,7 @@ var hat = require('hat')
|
||||
var inherits = require('inherits')
|
||||
var url = require('url')
|
||||
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
var TIMEOUT = 15000
|
||||
|
@ -9,7 +9,7 @@ var inherits = require('inherits')
|
||||
var Peer = require('simple-peer')
|
||||
var Socket = require('simple-websocket')
|
||||
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
// Use a socket pool, so tracker clients share WebSocket objects for the same server.
|
||||
// In practice, WebSockets are pretty slow to establish, so this gives a nice performance
|
||||
@ -38,6 +38,7 @@ function WebSocketTracker (client, announceUrl, opts) {
|
||||
|
||||
self._peers = {} // peers (offer id -> peer)
|
||||
self._socket = null
|
||||
|
||||
self._intervalMs = self.client._intervalMs // use client interval initially
|
||||
self._interval = null
|
||||
|
@ -5,6 +5,7 @@
|
||||
var extend = require('xtend/mutable')
|
||||
|
||||
exports.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
|
||||
exports.DEFAULT_ANNOUNCE_INTERVAL_WEBRTC = 60 * 1000 // 1 minute
|
||||
|
||||
exports.DEFAULT_ANNOUNCE_PEERS = 50
|
||||
exports.MAX_ANNOUNCE_PEERS = 82
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = parseHttpRequest
|
||||
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
var REMOVE_IPV4_MAPPED_IPV6_RE = /^::ffff:/
|
||||
|
@ -2,7 +2,7 @@ module.exports = parseUdpRequest
|
||||
|
||||
var bufferEqual = require('buffer-equal')
|
||||
var ipLib = require('ip')
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
function parseUdpRequest (msg, rinfo) {
|
||||
if (msg.length < 16) throw new Error('received packet is too short')
|
@ -1,6 +1,6 @@
|
||||
module.exports = parseWebSocketRequest
|
||||
|
||||
var common = require('./common')
|
||||
var common = require('../common')
|
||||
|
||||
function parseWebSocketRequest (socket, params) {
|
||||
params = JSON.parse(params) // may throw
|
@ -12,8 +12,8 @@
|
||||
},
|
||||
"browser": {
|
||||
"./lib/common-node": false,
|
||||
"./lib/http-tracker": false,
|
||||
"./lib/udp-tracker": false,
|
||||
"./lib/client/http-tracker": false,
|
||||
"./lib/client/udp-tracker": false,
|
||||
"./server": false
|
||||
},
|
||||
"bugs": {
|
||||
|
@ -11,10 +11,10 @@ var string2compact = require('string2compact')
|
||||
var WebSocketServer = require('ws').Server
|
||||
|
||||
var common = require('./lib/common')
|
||||
var Swarm = require('./lib/swarm')
|
||||
var parseHttpRequest = require('./lib/parse_http')
|
||||
var parseUdpRequest = require('./lib/parse_udp')
|
||||
var parseWebSocketRequest = require('./lib/parse_websocket')
|
||||
var Swarm = require('./lib/server/swarm')
|
||||
var parseHttpRequest = require('./lib/server/parse-http')
|
||||
var parseUdpRequest = require('./lib/server/parse-udp')
|
||||
var parseWebSocketRequest = require('./lib/server/parse-websocket')
|
||||
|
||||
inherits(Server, EventEmitter)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user