How givpn/autoscriptxray works
Project Type and Purpose
• This is an infrastructure automation project—a Bash-based installer & manager for VPN/SSH services on Debian/Ubuntu.
• The README and file tree show a “one-click” setup script (setup.sh) that installs and configures: OpenSSH, Dropbear, Stunnel4, various SSH-over-WebSocket/UDP services, Xray (VLESS/VMESS/Trojan/gRPC), Shadowsocks, Webmin (Helium), Bot Telegram panel, optional OpenVPN/SlowDNS (udp-custom), plus utilities (Fail2Ban, BBRPLUS, speedtest, auto-reboot).
File Structure Analysis
• Root
• setup.sh (orchestrator)
• menu/ (interactive menu scripts)
• rootvps.sh (helper)
• service folders (ssh/, sshws/, xray/, grpc/, openvpn/, slowdns/, udp-custom/, websocket/, helium/, bot telegram panel/, fix/, etc.)
• config templates (ssh/nginx.conf, udp-custom/config.json, banner/, privacy/, sshd_config)
• Each service folder contains scripts to install, add users, renew, delete, and check status.
• Cron jobs, systemd service units (.service under sshws/, websocket/ws-dropbear.service, etc.), and helper scripts in menu/ indicate a modular, script-per-component pattern.
README Insights
• Describes supported OS, domain & Cloudflare DNS settings, service & port mapping.
• Lists features (auto-reboot, user expiration cleanup, speedtest, BBR, DNS changer).
• Shows optional installs: Panel Webmin (Helium) and Telegram Bot.
a. Main Components
• User (sysadmin) invoking setup.sh (CLI orchestrator).
• Core OS Platform: Debian/Ubuntu host with systemd and networking stack.
• Service modules:
• SSH Stack: OpenSSH, Dropbear, SSH-over-WebSocket (sshws), SSH UDP Custom (slowdns + udp-custom).
• TLS Proxy: Stunnel4.
• WebSocket & gRPC Gateways: Nginx (for WS/TLS), Xray core (VMESS/VLESS/Trojan/gRPC), websocket scripts.
• VPN: OpenVPN (udp-custom/openvpn).
• Management: Webmin panel (Helium), Telegram Bot panel.
• Utilities: Fail2Ban, BBRPLUS, speedtest, auto-reboot & cron jobs.
• External: Domain Name & DNS (Cloudflare), Telegram API.
b. Relationships & Interactions
• setup.sh → executes menu/menu.sh → calls individual service installers.
• Each installer script ↔ OS package manager (apt), systemd unit files, config directories (e.g., /etc/ssh/, /etc/xray/).
• Nginx routes HTTP/WS traffic to Xray or SSH WS endpoints.
• Stunnel terminates TLS on configured ports and proxies to internal services.
• Cron jobs (via cron.d) manage auto-reboots, user expiry cleanup, speedtest.
• Telegram Bot connects to local script hooks (via polling or webhook) to administer users.
• Webmin (Helium) exposes a web UI on port 10000 for system management.
c. Architectural Patterns & Principles
• Modular script-per-service pattern for isolation and easier updates.
• Layered proxy approach: Nginx → Xray/gRPC and Stunnel → underlying daemons.
• Configuration-as-code: template + scripted deployment.
• CLI‐driven orchestration with interactive menus.
d. Key Technologies & Frameworks
• Bash & shell scripts (orchestration).
• APT (package management), systemd (service management), cron (job scheduling).
• OpenSSH, Dropbear, Stunnel4.
• Xray core (Go-based proxy), Webmin (Perl/PHP panel), Telegram Bot (shell + xolpanel.sh).
• Nginx (HTTP & WebSocket proxy), SlowDNS (Go).
• Speedtest CLI (Python), BBRPLUS kernel module.