const addrToIPPort = require('addr-to-ip-port'); const bencode = require('bencode'); const fakePeerId = require('../fakePeerId'); module.exports = (peers, res) => { const response = bencode.encode({ interval: 30 * 60, // 30 minutes between requests peers: peers.map((peer) => { const [ip, port] = addrToIPPort(peer); return { ip, 'peer id': fakePeerId(peer), port, }; }), }); res .set({ 'Content-Length': response.length, }) .end(response); };