/var/www/node_modules/bittorrent-tracker/lib/client/udp-tracker.js:106
Socks.createConnection(proxyOpts, onGotConnection)
^
TypeError: Socks.createConnection is not a function
at UDPTracker._request (/var/www/node_modules/bittorrent-tracker/lib/client/udp-tracker.js:106:15)
at UDPTracker.scrape (/var/www/node_modules/bittorrent-tracker/lib/client/udp-tracker.js:37:10)
at /var/www/node_modules/bittorrent-tracker/client.js:206:15
at Array.forEach (<anonymous>)
at Client.scrape (/var/www/node_modules/bittorrent-tracker/client.js:204:20)
at Object.<anonymous> (/var/www/torrent-tracker2.js:42:8)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
Scrape.js example
var Tracker = require('bittorrent-tracker')
var magnet = require('magnet-uri')
var magnetURI = "magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4"
var parsedTorrent = magnet(magnetURI)
var opts = {
infoHash: parsedTorrent.infoHash,
announce: parsedTorrent.announce,
peerId: new Buffer('01234567890123456789'), // hex string or Buffer
port: 6881, // torrent client port
proxyOpts: {
// Socks proxy options (used to proxy requests in node)
socksProxy: {
// Configuration from socks module (https://github.com/JoshGlazebrook/socks)
proxy: {
// IP Address of Proxy (Required)
ipaddress: "proxy_ip",
// TCP Port of Proxy (Required)
port: 1085,
// Proxy Type [4, 5] (Required)
// Note: 4 works for both 4 and 4a.
// Type 4 does not support UDP association relay
type: 5,
},
// Amount of time to wait for a connection to be established. (Optional)
// - defaults to 10000ms (10 seconds)
timeout: 10000
},
// NodeJS HTTP agents (used to proxy HTTP and Websocket requests in node)
// Populated with Socks.Agent if socksProxy is provided
httpAgent: {},
httpsAgent: {}
}
}
var client = new Tracker(opts)
client.scrape()
client.on('scrape', function (data) {
console.log(data)
})
What version of this package are you using?
v9.18.3
What operating system, Node.js, and npm version?
nodejs - v14.18.3 npm - 6.14.15
What happened?
Using socks5 results in this error
Scrape.js example