Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bittorrent-relay

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bittorrent-relay - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

27

index.js

@@ -245,15 +245,12 @@ import Debug from 'debug'

}
} else if(req.method === 'GET' && req.url.startsWith('/i')){
const test = req.url.split('/').filter(Boolean)
if(test.length === 1){
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify(this.sendTo))
} else if(test.length === 2){
res.setHeader('Content-Type', 'application/json')
res.end(this.sendTo[test[1]] ? JSON.stringify(this.sendTo[test[1]]) : [])
} else {
throw new Error(`invalid action in HTTP request: ${req.url}`)
}
} else if(req.method === 'GET' && req.url === '/i'){
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify(this.sendTo))
} else if(req.method === 'GET' && req.url.startsWith('/i/')){
const test = req.url.replace('/i/', '')
res.setHeader('Content-Type', 'application/json')
res.end(this.sendTo[test] ? JSON.stringify(this.sendTo[test]) : JSON.stringify([]))
} else {
throw new Error(`invalid action in HTTP request: ${req.url}`)
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify('error'))
}

@@ -428,5 +425,5 @@ }

}
self.trackers.forEach((data) => {
data.send(JSON.stringify(self.status))
})
for(const track in self.trackers){
self.trackers[track].send(JSON.stringify({action: 'status', ...self.status}))
}
// send url of another tracker before closing server, if no tracker is available then close server

@@ -433,0 +430,0 @@ } else {

{
"name": "bittorrent-relay",
"description": "Uses the mainline dht to relay requests to other trackers in a swarm",
"version": "1.0.3",
"version": "1.0.4",
"bin": {

@@ -6,0 +6,0 @@ "bittorrent-tracker": "./bin/cmd.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc