webtorrent / bittorrent-tracker

🌊 Simple, robust, BitTorrent tracker (client & server) implementation
https://webtorrent.io
MIT License
1.75k stars 317 forks source link

Tracker fails to work when pushed to a VPS #424

Closed zackees closed 1 year ago

zackees commented 2 years ago

I'm trying to setup a tracker and I am running into problems with dev ops. Everything tests fine in local but can't connect to a public server.

Works:

Test setup

Repro Instructions:

  1. Choose AWS/DigitalOcean/etc
  2. create a VPS
  3. login with shell
  4. install npm install -g bittorrent-tracker
  5. Turn off the firewall ports ufa disable all ?
  6. Run bittorrent-tracker
  7. Get the IP address of the VPS server
  8. Then attempt to connect (see below) to the tracker a. using this "Client Code" to seed a file below b. Copy the resulting magnetURI from stdout
  9. Open up webtorrent-desktop and paste in the magnetURI

Client Seeder Code:

const WebTorrent = require('webtorrent')
const client = new WebTorrent()
const TRACKERS = [ "http://123.123.123.123:8000/announce" ]
const FILES = ["movie.mp4"]
console.log("Seeding: ", FILES)
const options = { announce: TRACKERS }
client.seed(FILES, options, torrent => {
    console.log(`Seeded: ${torrent.name}\nmagnetURI: ${torrent.magnetURI}`)
})

Server code

npm install -g bittorrent-tracker && bittorrent-tracker

So what happens?

On the local machine, everything works great! On a VPS though? Something is going wrong:

> bittorrent-tracker
HTTP tracker: http://localhost:8000/announce
UDP tracker: udp://0.0.0.0:8000
UDP6 tracker: udp://localhost:8000
WebSocket tracker: ws://localhost:8000
Tracker stats: http://localhost:8000/stats
start: 199.83.223.254:54158
stop: 199.83.223.254:51741
start: 199.83.223.254:51741

The clients can connect to one another, but no transfer ever starts between the two connected clients, the seeder and the webtorrent-desktop client. However if using http://localhost:8000/announce tracker address then the transfer does complete.

What version of this package are you using?

What problem do you want to solve?

What do you think is the correct solution to this problem?

It should work as well as localhost.

Are you willing to submit a pull request to implement this change?

Yes.

What version of this package are you using?

Latest

What operating system, Node.js, and npm version?

Ubuntu 20LTS, Nodejs latest, npm latest

Are you willing to submit a pull request to fix this bug?

Yes.

github-actions[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?