15 lines
340 B
JavaScript
15 lines
340 B
JavaScript
const bencode = require('bencode');
|
|
const string2compact = require('string2compact');
|
|
|
|
module.exports = (peers, res) => {
|
|
const response = bencode.encode({
|
|
interval: 30 * 60, // 30 minutes between requests
|
|
peers: string2compact(peers),
|
|
});
|
|
res
|
|
.set({
|
|
'Content-Length': response.length,
|
|
})
|
|
.end(response);
|
|
};
|