$ show fscarmen/sing-box
This repository contains a monolithic Bash script (`sing-box.sh`) that automates the deployment, configuration, and management of the sing-box proxy server on Linux VPS. It supports 12+ proxy protocols (Reality, Hysteria2, TUIC, ShadowTLS, Shadowsocks, Trojan, VMess/VLess over WebSocket, H2/gRPC Reality, AnyTLS, NaiveProxy) and integrates Cloudflare Argo Tunnel for CDN-based inbound. The script handles end-to-end setup: dependency installation, self-signed certificate generation, sing-box binary download, JSON configuration generation for each protocol, firewall rule management (iptables/UFW/firewalld), and creation of systemd/OpenRC service files. It also generates subscription links for multiple clients (Clash, V2rayN, ShadowRocket, Throne, sing-box) and provides a menu-driven interface for post-install modifications (port changes, CDN switching, protocol add/remove, WARP account management). The architecture is a single large Bash script with modular functions, heavy use of global variables, and runtime dependency fetching. While functional and actively maintained, the codebase is tightly coupled and not designed for reuse outside its specific deployment context.
The LLM identified 3 files worth highlighting for reuse:
Probes GitHub raw and releases endpoints in parallel to determine if direct access is available, falling back to a list of proxy mirrors. Uses wget/curl with HTTP HEAD requests and concurrent subprocesses. The logic is self-contained and could be extracted as a generic CDN/proxy detection utility for any script that needs to decide whether to use a mirror.
Detects whether the server's IP can access OpenAI/ChatGPT by sending two HTTP requests (API compliance endpoint and web page) with browser-like headers. Returns 'unlock' or 'ban' based on response content. The pattern is reusable for any geo-blocking check and demonstrates careful handling of TLS/cipher issues and fallback logic.
Creates and manages Cloudflare Argo tunnels via the Cloudflare API. Handles zone/account ID retrieval, tunnel creation or reuse, ingress configuration, and DNS CNAME record management. Includes error handling for API permission issues and token validation. This is a non-trivial integration with Cloudflare's v4 API that could be adapted for other tunnel automation projects.