$ show mercurykd/vpnbot
This repository is a production-ready Telegram bot that manages a multi-protocol VPN/proxy server infrastructure deployed via Docker Compose. It supports WireGuard, Xray (VLESS), Shadowsocks, OpenConnect, NaiveProxy, Hysteria, MTProto, and others, plus AdGuard Home for DNS filtering and split tunneling via PAC files. The bot handles user subscriptions, configuration generation, service restarts, IP banning, and automated maintenance (cron, log analysis, backups). The architecture is monolithic: a single large PHP script (app/bot.php ~5000 lines) processes Telegram webhooks and executes commands on Docker containers via SSH. The codebase is functional and actively used (500+ stars) but suffers from lack of tests, tight coupling, hardcoded infrastructure assumptions, and security concerns (Docker socket exposure, SSH in every container). Reusable components are limited, with app/calc.php (CIDR calculation) being a standout isolated utility.
The LLM identified 1 files worth highlighting for reuse:
A self-contained PHP class for calculating IP ranges from CIDR notation. It provides methods to convert CIDR to list of IPs, compute subnet ranges, and perform related network math. The class has no external dependencies and could be extracted into any PHP project needing IP range manipulation. This demonstrates clean, isolated utility code in a codebase that is otherwise tightly coupled.