настройки паучка
This commit is contained in:
@ -21,4 +21,10 @@ module.exports = {
|
|||||||
database : 'btsearch',
|
database : 'btsearch',
|
||||||
connectionLimit: 40
|
connectionLimit: 40
|
||||||
},
|
},
|
||||||
|
|
||||||
|
spider: {
|
||||||
|
walkInterval: 5,
|
||||||
|
cpuLimit: 0,
|
||||||
|
cpuInterval: 10,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
4
index.js
4
index.js
@ -504,4 +504,6 @@ client.on('complete', function (metadata, infohash, rinfo) {
|
|||||||
|
|
||||||
// spider.on('nodes', (nodes)=>console.log('foundNodes'))
|
// spider.on('nodes', (nodes)=>console.log('foundNodes'))
|
||||||
|
|
||||||
spider.listen(config.spiderPort)
|
if(config.indexer) {
|
||||||
|
spider.listen(config.spiderPort)
|
||||||
|
}
|
@ -6,6 +6,7 @@ const bencode = require('bencode')
|
|||||||
const {Table, Node} = require('./table')
|
const {Table, Node} = require('./table')
|
||||||
const Token = require('./token')
|
const Token = require('./token')
|
||||||
const cpuUsage = require('./cpu-usage')
|
const cpuUsage = require('./cpu-usage')
|
||||||
|
const config = require('../config')
|
||||||
|
|
||||||
const bootstraps = [{
|
const bootstraps = [{
|
||||||
address: 'router.bittorrent.com',
|
address: 'router.bittorrent.com',
|
||||||
@ -40,9 +41,9 @@ class Spider extends Emiter {
|
|||||||
this.client = client
|
this.client = client
|
||||||
this.ignore = false; // ignore all requests
|
this.ignore = false; // ignore all requests
|
||||||
|
|
||||||
this.walkInterval = 5;
|
this.walkInterval = config.spider.walkInterval;
|
||||||
this.cpuLimit = 0;
|
this.cpuLimit = config.spider.cpuLimit;
|
||||||
this.cpuInterval = 10;
|
this.cpuInterval = config.spider.cpuInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
send(message, address) {
|
send(message, address) {
|
||||||
|
Reference in New Issue
Block a user