2 Commits

2 changed files with 79 additions and 16 deletions

View File

@@ -1,32 +1,51 @@
# Trackers
Опрашивает ссылки со списками torrent-трекеров,
соединяет их в один список. Поддерживает кеширование,
http, file источники.
A torrent tracker aggregator that polls multiple sources and serves a unified,
deduplicated list of tracker URLs via HTTP API.
Учебный проект.
**Educational project written in Go 1.25.5**
## Запуск
## Features
- Polls tracker sources at configurable intervals
- Supports HTTP/HTTPS and local file sources
- Deduplicates and validates tracker URLs
- Persistent disk caching for resilience
- HTTP proxy support via environment variables
- Request logging for monitoring
- Single binary with minimal dependencies
## Usage
```shell
trackers --config config.toml
trackers -config config.toml
```
Получение списка трекеров:
Get the aggregated tracker list:
```shell
curl http://127.0.0.1:8080/list
```
## Конфигурация
## Configuration
Источники для трекеров описываются в toml-конфиге:
See [config.dist.toml](config.dist.toml) for a complete configuration example with comments.
```toml
port = 8080
Copy the example file and customize:
sources = [
"https://example.com",
"file:///home/user/local-file.txt",
]
```
```shell
cp config.dist.toml config.toml
# Edit config.toml with your sources
```
## Proxy Support
HTTP requests respect standard proxy environment variables:
```shell
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
trackers -config config.toml
```
See [config.dist.toml](config.dist.toml) for details.

44
config.dist.toml Normal file
View File

@@ -0,0 +1,44 @@
# Trackers Configuration Example
# Copy this file to config.toml and adjust values for your setup
# HTTP server port
# Default: 8080
port = 8080
# Directory for caching tracker lists
# Used to persist tracker data between restarts and handle source failures
# Default: "cache"
cache_dir = "cache"
# Interval between polling each source
# Valid units: s (seconds), m (minutes), h (hours)
# Examples: "30s", "5m", "1h", "90m"
# Default: "60m"
poll_interval = "60m"
# List of tracker sources to aggregate
# Supported schemes:
# - http:// / https:// - Remote HTTP endpoints
# - file:// - Local files (e.g., file:///path/to/trackers.txt)
#
# Each source should return tracker URLs, one per line
# Blank lines and duplicates are automatically filtered
sources = [
"https://example.com/trackers/all.txt",
"https://another-source.org/trackers.txt",
# "file:///etc/trackers/local.txt",
]
# Proxy Configuration
# ==================
# HTTP requests automatically respect standard proxy environment variables:
#
# HTTP_PROXY - Proxy for HTTP requests (e.g., http://proxy.example.com:8080)
# HTTPS_PROXY - Proxy for HTTPS requests (e.g., http://proxy.example.com:8080)
# NO_PROXY - Comma-separated list of hosts to bypass proxy (e.g., localhost,127.0.0.1)
#
# Example usage:
# export HTTP_PROXY=http://proxy.example.com:8080
# export HTTPS_PROXY=http://proxy.example.com:8080
# export NO_PROXY=localhost,127.0.0.1,.local
# ./trackers -config config.toml