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 # Enable recover (fiber won't be closed from a panic)
prefork: true # Enable prefork (Concurrency)
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%
GOMAXPROCS: 8 # Max opened thread
tracker:
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)
api:
key: SomethingLong # api key for communication between the tracker and the site
log:
path: "" # 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: 1801 # 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)
orm:
driver: mysql # driver of the sql database (mysql/postgres/sqlite (not recomended))
username: root # database username
password: yagptt # database password
host: 127.0.0.1 # database host
port: 3306 # database port
database: yagptt # database name
# path: "./database.db" # database path for sqlite
π 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
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;
}
}