Yet Another Go Private Torrent Tracker (YAGPTT)
Simple private Torrent Tracker Backend writen in go with Fiber web framework
A frontend will come next
(Not yet operational for production)
π© Requirement
π§ Installation
go get gitea.s1.thoxy.xyz/thoxy/yagptt
π¬ Usage
Copy the example file called config.example.yaml to config.yaml.
Edit config.yaml and set the following fields with your own informations :
server:
address: :2048 # Adresse to listen on
timezone: "Europe/Paris" # Timezone
recover: true # recovers from panics anywhere in the stack chain and handles the control to the centralized ErrorHandler.
prefork: true # When set to true, this will spawn multiple Go processes listening on the same port.
reduce_memory_usage: false # Try enabling this option only if the server consumes too much memory serving mostly idle keep-alive connections. This may reduce memory usage by more than 50%
tracker:
mode: "private" # Mode (public or private) only public work for now
interval: 1801 # Interval announce
max_numwant: 200 # Max numwant allowed in announce request
default_numwant: 50 # Default numwant if not provided
max_scrape_info_hashes: 50 # Maximum number of infohash returned after scrape request (-1: infinite, 0: none, any other number defines the number of infohash returned)
announce_warning_message: "" # Warning message the tracker send on every requests (not all client can show it)
log:
path: "./debug.log" # if nothing it's print into console but it's less good for server performance
level: 0 # -1: trace, 0: debug, 1: info, 2: warn, 3: err, 4: fatal, 5: panic
nocolor: false # If you use console output you can set if you want color output
force_console_format: false # If you use file output but you want to force use console format
time_format: "2006-01-02T15:04:05Z07:00" # Time format for output
reset_on_startup: true # Clear the log file on every startup
storage:
memory:
interval_garbage_collector: 10 # garbage collector interval (automatic deletion of unused peers, the shorter the interval, the more CPU it consumes, conversely, the longer the interval, the more RAM the program consumes)
mysql:
driver: "mysql" # driver of the sql database
uri: "root:yagptt@tcp(yagptt-mariadb:3306)/yagptt" # uri of the database
π Run
In the same folder as config.yaml, run the following command from a terminal:
yagptt
or
yagptt --config ./config.yml
You're good to go ! π
β Troubleshooting
For now you need to import the database.sql manualy.
If you want you can import the front.sql but is optional.
Make it work behind Nginx reverse proxy
If you want to use behind a nginx reverse proxy you need to add this tow lines :
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
in the location "/" of the tracker host.
Exemple for swag reverse proxy :
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name tk.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth, fill in ldap details in ldap.conf
#include /config/nginx/ldap.conf;
# enable for Authelia
#include /config/nginx/authelia-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable the next two lines for ldap auth
#auth_request /auth;
#error_page 401 =200 /ldaplogin;
# enable for Authelia
#include /config/nginx/authelia-location.conf;
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
set $upstream_app yagptt;
set $upstream_port 2048;
set $upstream_proto http;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}