1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! REST API module for tracker management and statistics.
//!
//! This module provides HTTP endpoints for managing the tracker through a REST API.
//! It supports operations on torrents, users, whitelists, blacklists, API keys,
//! and provides statistics and monitoring endpoints.
//!
//! # Endpoints Overview
//!
//! ## Statistics
//! - `GET /stats` - Get tracker statistics in JSON format
//! - `GET /metrics` - Get Prometheus-format metrics
//!
//! ## Torrents
//! - `GET /api/torrent/{info_hash}` - Get torrent information
//! - `POST /api/torrent/{info_hash}/{completed}` - Add/update torrent
//! - `DELETE /api/torrent/{info_hash}` - Delete torrent
//! - `GET /api/torrents` - List all torrents
//! - `POST /api/torrents` - Batch add/update torrents
//! - `DELETE /api/torrents` - Batch delete torrents
//!
//! ## Whitelist
//! - `GET /api/whitelist/{info_hash}` - Check if hash is whitelisted
//! - `POST /api/whitelist/{info_hash}` - Add hash to whitelist
//! - `DELETE /api/whitelist/{info_hash}` - Remove from whitelist
//! - `GET /api/whitelists` - List all whitelisted hashes
//!
//! ## Blacklist
//! - `GET /api/blacklist/{info_hash}` - Check if hash is blacklisted
//! - `POST /api/blacklist/{info_hash}` - Add hash to blacklist
//! - `DELETE /api/blacklist/{info_hash}` - Remove from blacklist
//! - `GET /api/blacklists` - List all blacklisted hashes
//!
//! ## API Keys
//! - `GET /api/key/{key_hash}` - Get key information
//! - `POST /api/key/{key_hash}/{timeout}` - Create key with timeout
//! - `DELETE /api/key/{key_hash}` - Delete key
//! - `GET /api/keys` - List all keys
//!
//! ## Users
//! - `GET /api/user/{id}` - Get user information
//! - `POST /api/user/{id}/{key}/{uploaded}/{downloaded}/{completed}/{updated}/{active}` - Create/update user
//! - `DELETE /api/user/{id}` - Delete user
//! - `GET /api/users` - List all users
//!
//! ## SSL Certificate Management
//! - `POST /api/certificate/reload` - Hot-reload SSL certificates
//! - `GET /api/certificate/status` - Get certificate status
//!
//! # Authentication
//!
//! All API endpoints require a valid API token passed as a query parameter:
//! `?token=<api_key>`
/// Data structures for API service context.
/// Core API service functions and route configuration.
/// Blacklist management endpoints.
/// SSL certificate management endpoints.
/// API key management endpoints.
/// Torrent management endpoints.
/// User management endpoints.
/// Whitelist management endpoints.
/// Statistics and monitoring endpoints.