2024-06-14 15:15:11 +00:00
|
|
|
import { Server } from "bittorrent-tracker";
|
2024-06-14 14:57:55 +00:00
|
|
|
|
|
|
|
const PORT = process.env.TRACKER_PORT || 8106;
|
2024-06-14 15:15:11 +00:00
|
|
|
const HOST = process.env.TRACKER_HOST || "localhost";
|
2024-06-14 14:57:55 +00:00
|
|
|
|
|
|
|
const server = new Server({
|
|
|
|
udp: true,
|
|
|
|
http: true,
|
|
|
|
ws: true,
|
|
|
|
stats: true,
|
|
|
|
});
|
|
|
|
|
2024-06-14 15:15:11 +00:00
|
|
|
server.on("error", (err) => {
|
2024-06-14 14:57:55 +00:00
|
|
|
console.error(`Error: ${err.message}`);
|
|
|
|
});
|
|
|
|
|
2024-06-14 15:15:11 +00:00
|
|
|
server.on("warning", (err) => {
|
2024-06-14 14:57:55 +00:00
|
|
|
console.warn(`Warning: ${err.message}`);
|
|
|
|
});
|
|
|
|
|
2024-06-14 15:15:11 +00:00
|
|
|
server.on("listening", () => {
|
2024-06-14 15:14:29 +00:00
|
|
|
console.log(`Tracker is listening on http://${HOST}:${PORT}`);
|
2024-06-14 14:57:55 +00:00
|
|
|
});
|
|
|
|
|
2024-06-14 15:15:11 +00:00
|
|
|
server.listen(PORT);
|