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({
|
2024-06-15 14:23:35 +00:00
|
|
|
udp: false,
|
2024-06-16 13:54:00 +00:00
|
|
|
http: false,
|
2024-06-14 14:57:55 +00:00
|
|
|
ws: true,
|
2024-06-15 14:23:35 +00:00
|
|
|
stats: false,
|
2024-06-14 14:57:55 +00:00
|
|
|
});
|
|
|
|
|
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);
|