2014-06-07 15:10:12 -07:00
|
|
|
/**
|
2014-07-12 18:44:41 -07:00
|
|
|
* Functions/constants needed by both the client and server.
|
2014-06-07 15:10:12 -07:00
|
|
|
*/
|
|
|
|
|
|
2015-05-03 16:53:37 -07:00
|
|
|
exports.DEFAULT_ANNOUNCE_PEERS = 50
|
2014-12-10 00:44:45 +01:00
|
|
|
exports.MAX_ANNOUNCE_PEERS = 82
|
|
|
|
|
|
2014-12-12 02:02:11 -08:00
|
|
|
exports.binaryToHex = function (str) {
|
2016-05-29 23:12:23 -07:00
|
|
|
if (typeof str !== 'string') {
|
|
|
|
|
str = String(str)
|
|
|
|
|
}
|
|
|
|
|
return Buffer.from(str, 'binary').toString('hex')
|
2014-12-12 02:02:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.hexToBinary = function (str) {
|
2016-05-29 23:12:23 -07:00
|
|
|
if (typeof str !== 'string') {
|
|
|
|
|
str = String(str)
|
|
|
|
|
}
|
|
|
|
|
return Buffer.from(str, 'hex').toString('binary')
|
2014-07-12 18:44:41 -07:00
|
|
|
}
|
2014-07-10 21:28:37 -07:00
|
|
|
|
2015-03-24 01:52:21 -07:00
|
|
|
var config = require('./common-node')
|
2018-10-02 15:09:02 +02:00
|
|
|
Object.assign(exports, config)
|