novage / wt-tracker Goto Github PK
View Code? Open in Web Editor NEWHigh-performance WebTorrent tracker
License: Apache License 2.0
High-performance WebTorrent tracker
License: Apache License 2.0
Hi!
I'm having a error response.
(Error during WebSocket handshake: Unexpected response code: 200)
my config.json:
{
"servers": [{
"server": {
"port": 8000,
"host": "0.0.0.0"
},
"websockets": {
"path": "/*",
"maxPayloadLength": 65536,
"idleTimeout": 240,
"compression": 1,
"maxConnections": 0
}
}
],
"tracker": {
"maxOffers": 20,
"announceInterval": 120
},
"websocketsAccess": {
"denyEmptyOrigin": true
}
}
in p2p-media-loader-core.js:
trackerAnnounce: ["ws://35.193.240.193", "wss://tracker.openwebtorrent.com"],
when i set ws://35.193.240.193:8000 in trackerAnnounce, i get the error:
failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
P.s:
I moved the config.json file from the "sample" folder to the root and run this (npm start config.json)
when video finish and replay button appear, when we click replay it got error and no replay video. any solution?
Hi there,
Maintainer of bittorrent-tracker
here. Just wondering if you had any interest in upstreaming your improvements back into the main bittorrent-tracker
package so that more users could benefit from your work here.
Thanks!
If i set /allowOrigins/ it stop everything unless it gets that origin.
Is there a way to keep it, but allow somehow seeding from the webtorrent hybrid?
Thank you!
Hey, first of all thanks for a great repository.
I noticed what I think is a bug, when I was testing the tracker. I was making use of a minimal frontend demo from p2p-media-loader, and wanted to try my own tracker.
When I use wt-tracker, I was testing on a remote server, with one instance on my PC and one on my mobile. PC is on Lan, and Mobile is on Wifi (different networks, but more on this later).
So initially when the tracker is first loaded, communication works great, I can see load being shared, and p2p requests / announces being sent. But if I reload the tab / website in either my PC or my phone, an exception is thrown which I have traced back to
Line 127 in 0903e41
The error specifically is (in the tracker console):
Invalid access of closed uWS.WebSocket/SSLWebSocket.
And p2p communication stops. When I reloaded on my phone, (so I could check PC chrome console), I saw an Ice Connection error as well (might be related to old peer data which doesn't exist? And since tracker crashed cannot get new peer, so unloaded PC tries to communicate with old peer)
2p-media-loader-core.min.js:1 p2pml:media-peer peer error +888ms 06ddf104bb2ff52210bc9c0394b7f48f912a420d Error: Ice connection failed.
at l (p2p-media-loader-core.min.js:1)
at c._onIceStateChange (p2p-media-loader-core.min.js:1)
at RTCPeerConnection.r._pc.oniceconnectionstatechange (p2p-media-loader-core.min.js:1) n.MediaPeer {_events: {…}, _eventsCount: 10, _maxListeners: undefined, peer: c, settings: {…}, …}
p2p-media-loader-core.min.js:1 p2pml:media-peer peer close +1ms 06ddf104bb2ff52210bc9c0394b7f48f912a420d n.MediaPeer {_events: {…}, _eventsCount: 10, _maxListeners: undefined, peer: c, settings: {…}, …}
and then rightly discards the non-responsive peer.
I have tried the same refresh scenario with bitorrent-tracker, and have not observed a crash, so I think it is specific to this library, rather than wss based trackers.
Further, a simple restart of the tracker and waiting around ~30 secs the two devices connect again and communication begins.
So, theoretically I guess using pm2 it is possible to restart on this crash, but if it could be avoided then its probably better.
Lastly, I've been reading the code since I am extremely interested in P2P and had initially thought of making something on my own before I discovered your amazing work. However, I'm having some trouble reading it initially, since the work I've done in node.js is mostly server-side, and I'm unfamiliar with .ts
and some files just containing what seem like definitions. If you could point me in the right direction I'd greatly appreciate it, and hopefully I can contribute a lot of features to the repository!
Thanks
P.S. on my two devices I have two separate public IPs, but in the console I can see the IP that it gets of my phone as a private one (both are connected to different networks but by my University), was wondering how this works? Not asking for a detailed explanation, but just a few keywords I can search and read up on.
hi sir, i try to build the tracker.. but i confuse, when i connect using wss or ws always return 404. i try to add index.html header return 404 no 101 switching
wt-trackers seems not stable. always exit after a while.
And I cann't find error logs.
I've been trying without success. Have anyone been able to run this dockerized?
I installed tracker and it work with SLL only on 443 port. if i change ports in config, then tracker not started and crashed.
Tell me pls sample of config, how to start tracker on custom SSL ports?
Tracker websocket handshake always fails with this message.
I can see the server is running and I can get 404 no response when visit the server url.
Is this an issue or did I configure something wrong?
Thank you
Hello,
I've noticed that on p2p-media-loader's demo page I am unable to connect to wss://tracker.novage.com.ua
:
WebSocket connection to 'wss://tracker.novage.com.ua/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Today I am running wt-tracker for testing purposes on a VPS and I am experiencing the same issue on my server. HTTP appears to work properly without issues, but HTTPS comes up with the same error, while uws-tracker-requests
debug does not show any connection attempts for HTTPS. Wt-tracker starts normally without errors, and port 443
comes up correctly when checked:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3895/node
tcp 0 0 0.0.0.0:433 0.0.0.0:* LISTEN 3895/node
Testing with other trackers like wss://tracker.openwebtorrent.com
does work . I did not see such an issue opened or closed so could it be somehow on my end? Can anyone confirm they have the same issue?
EDIT
Tested on Mac and Windows 10, with Chrome and Firefox latest. Results are the same.
Thank you
Hello,
After I update to the latest version I found that stats.json has addition info peersCountPerInfoHash when connection is hight it's seem to slow down stats.json. Is it possible to disable it for showing ?
Regards,
Steven
/home/wt-tracker/dist/uws-tracker.js:67
const origin = request.getHeader("origin");
^
TypeError: Cannot read properties of undefined (reading 'getHeader')
at UWebSocketsTracker.onOpen (/home/wt-tracker/dist/uws-tracker.js:67:40)
How to Fix it ? i try change onOpen to onUpdate but allow origin not working.
Detail guide how to config file config.json.
I can not config it
Publish project on npm
and add documentation about its API and how to use it as a dependency.
how to bundle the latest of uWebSockets.js to wt-tracker ?
Hello
how can i get ip of peer in FastTracker.processMessage(json, peer) ?
When i'm run the tracker and try to connecting with P2P-Novage Player, i'm getting /dist/uws-tracker.js:69
const origin = request.getHeader("origin");
What i doing wrong to set up the enviroment?
I was looking at https://github.com/chihaya/chihaya and thought it'd be a good idea to support integrations such as exposing metrics that can be consumed by Prometheus and multiple servers by storing data in Redis.
I work for a rural educational network of a few elementary schools. The schools have varying internet connectivity. All the computers on each network run behind NAT and have a single IP exposed to the internet. I'd like to see if it's possible to only announce peers that come from the same IP address so that peering would be confined within each schools local network,
There wasn't a clear guide of how to install and run this tracker from scratch. I thought it would be helpful for others.
sudo yum install epel-release
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
sudo yum install nodejs
node -v
v12.17.0
yum install git
cd /usr/local
git clone https://github.com/Novage/wt-tracker.git
cd wt-tracker/
npm install
npm run build
#uWebSockets version v15.11.0 needed, so we are reinstalling uWebSockets
npm uninstall uWebSockets.js
npm install uNetworking/uWebSockets.js#v15.11.0
vi /usr/local/wt-tracker/config.json
{
"servers": [{
"server": {
"port": 80,
"host": "0.0.0.0"
},
"websockets": {
"path": "/*",
"maxPayloadLength": 65536,
"idleTimeout": 240,
"compression": 1,
"maxConnections": 0
}
}, {
"server": {
"port": 443,
"host": "0.0.0.0",
"key_file_name": "/etc/ssl/certs/key.pem",
"cert_file_name": "/etc/ssl/certs/crt.pem",
"ssl_prefer_low_memory_usage": true
},
"websockets": {
"path": "/*",
"maxPayloadLength": 65536,
"idleTimeout": 240,
"compression": 1
}
}
],
"tracker": {
"maxOffers": 20,
"announceInterval": 120
},
"websocketsAccess": {
"allowOrigins": ["https://website.com"],
"denyEmptyOrigin": true
}
}
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd --reload
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports: 80/tcp 443/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
vi /etc/systemd/system/wt-tracker.service
Description=WebTorrent Tracker
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
WorkingDirectory=/usr/local/wt-tracker
ExecStart=/usr/local/wt-tracker/bin/wt-tracker
[Install]
WantedBy=multi-user.target
systemctl enable wt-tracker
systemctl restart wt-tracker
systemctl status wt-tracker
● wt-tracker.service - WebTorrent Tracker
Loaded: loaded (/etc/systemd/system/wt-tracker.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-05-30 12:29:55 CEST; 30min ago
Main PID: 896 (node)
CGroup: /system.slice/wt-tracker.service
└─896 node /usr/local/wt-tracker/bin/wt-tracker
May 30 12:29:55 localhost systemd[1]: Started WebTorrent Tracker.
May 30 12:29:55 localhost wt-tracker[896]: listening 0.0.0.0:80
May 30 12:29:55 localhost wt-tracker[896]: listening 0.0.0.0:443
#This changes will fix Error: EMFILE: too many open files, uv_resident_set_memory
mkdir /etc/systemd/system/wt-tracker.service.d/
vi /etc/systemd/system/wt-tracker.service.d/limits.conf
[Service]
LimitNOFILE=65535
systemctl daemon-reload
systemctl restart wt-tracker.service
{
"torrentsCount": 0,
"peersCount": 0,
"servers": [
{
"server": "0.0.0.0:80",
"webSocketsCount": 0
},
{
"server": "0.0.0.0:443",
"webSocketsCount": 0
}
],
"memory": {
}
}
I got this error:
`/root/wt-tracker/node_modules/uWebSockets.js/uws.js:31
throw new Error('This version of µWS is not compatible with your Node.js build:\n\n' + e.toString());
^
Error: This version of µWS is not compatible with your Node.js build:
Error: /lib64/libc.so.6: version GLIBC_2.18' not found (required by /root/wt-tracker/node_modules/uWebSockets.js/uws_linux_x64_64.node) at module.exports (/root/wt-tracker/node_modules/uWebSockets.js/uws.js:31:9) at Object.<anonymous> (/root/wt-tracker/node_modules/uWebSockets.js/uws.js:33:3) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/root/wt-tracker/dist/uws-tracker.js:18:26)
When I run ./bin/wt-tracker config.json the Terminal showing
listening 0.0.0.0:443
listening 0.0.0.0:80
and wt-tracker works perfectly but when I close the Terminal window it will stop wt-tracker.
Thanks!
I am trying to setup wt-tracker to run behind nginx on https://example.com/wt but I am not able to curl https://example.com/wt/stats.json even though I can connect with wscat.
my config.json:
{
"servers": [{
"server": {
"port": 19823,
"host": "127.0.0.1"
},
"websockets": {
"path": "/*",
"maxPayloadLength": 65536,
"idleTimeout": 240,
"compression": 1,
"maxConnections": 100
}
}
],
"tracker": {
"maxOffers": 20,
"announceInterval": 120
},
"websocketsAccess": {
"allowOrigins": ["https://example.com"],
"denyEmptyOrigin": true
}
}
nginx entry:
location /wt {
proxy_pass http://127.0.0.1:19823/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
Do I need to change "path": "/*",
to something else? "/wt/*"
did not work for me as I got error 404 with wscat.
Is it even possible that such a setup succeeds?
I am trying to curl stats.json because I want to know that wt-tracker works correctly.
How to config logs for wt ?
i need save some information, example ip address of client, domain, error logs, access logs ... ?
cur statistics only show all torrent count and peer count.
can show every torrent info?it is very usefu.
How to use tracker "scrape" extension?
Could you guide me!
Hello again, could you make a release (and build w/o uWebSockets.js) ?
/* very many errors on 12.16 and there is no certainty that we our builds is correct */
and it would be nice to make a simple boot file
the same as https://github.com/webtorrent/bittorrent-tracker/blob/master/bin/cmd.js
with "filter: function (infoHash, params, cb)"
for compatibility and quick change ;-)
Thanks!
Error: This version of µWS is not compatible with your Node.js build:
Error: /lib64/libc.so.6: version `GLIBC_2.18' not found
How to fix ? i had tried but can't install glibc-2.18 on Centos 7.7
Hello,
Sorry, this is probably a stupid question, but I have issues installing WT-Tracker on my machine..
And while installing, I got a HUGE list like this of missing files..
Have I done something wrong ?
Thanks !
Is there a way to restore all the peer / seed / leech data when the app restarts?
When I try to run wt-tracker with node dist/run-uws-tracker.js config.json
I get:
`/home/pi/wt-tracker/node_modules/uWebSockets.js/uws.js:31
throw new Error('This version of µWS is not compatible with your Node.js build:\n\n' + e.toString());
^
Error: This version of µWS is not compatible with your Node.js build:
Error: Cannot find module './uws_linux_arm_88.node'
Require stack:
NodeJs v15.8.0
NPM v7.5.3
Hello,
From example config file https://github.com/Novage/wt-tracker/blob/master/sample/config.json
Can I assign only "allowOrigins" domain (I'm sure can I set wildcard for domain ?) with ""denyEmptyOrigin": true" ?
like this
"websocketsAccess": {
"allowOrigins": ["https://xxx.com", "https://yyy.com"],
"denyEmptyOrigin": true
}
Will only "https://xxx.com", "https://yyy.com" allow other which not in the allow list are deny ?
At
wt-tracker/lib/run-uws-tracker.ts
Lines 238 to 246 in 400a436
index.html
file. In the same way that serving the index.html
file is an opt-in, it would be useful to allow to check and serve a public
folder before give up and return a 404, maybe being the index.html
file inside it. That would allow to serve not only some Javascript and CSS files associated with the index.html
file, but more important, it would allow to serve the actual HLS fragments directly from the same server, without needing to spin-up other processes.I want to scale mutil wt-tracker machine as a cluster, how can i do ?
I have no good error messages from the underlying uWebSockets.js library about problems with SSL keys and other stuff. That is why just report "failed to start the web server: App construction failed"
I will try to improve the messages.
Originally posted by @mrlika in #10 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.