Files
proxy-installer/proxy.sh

72 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 顶尖协议一键脚本统一入口
# Mirror: https://mjjtop.com/proxy
# Protocols: ss2022+shadowtls / anytls / snell v5 / reality
set -euo pipefail
BASE_URL="${MIRROR_BASE_URL:-https://mjjtop.com/admin/proxy-installer/raw/branch/main}"
TMP_DIR="/tmp/mjjtop-proxy-installer"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
info(){ echo -e "${GREEN}[INFO]${NC} $*"; }
warn(){ echo -e "${YELLOW}[WARN]${NC} $*"; }
err(){ echo -e "${RED}[ERROR]${NC} $*" >&2; exit 1; }
if [[ "${PROXY_INSTALLER_SKIP_ROOT_CHECK:-0}" != "1" ]]; then
[[ ${EUID:-$(id -u)} -eq 0 ]] || err "请用 root 运行"
fi
command -v curl >/dev/null 2>&1 || err "缺少 curl请先安装: apt install -y curl"
mkdir -p "$TMP_DIR"
run_remote() {
local name="$1"
local script_path="$2"
local file="$TMP_DIR/$script_path"
info "下载 $name 脚本:$BASE_URL/scripts/$script_path"
curl -fsSL "$BASE_URL/scripts/$script_path" -o "$file"
chmod +x "$file"
info "开始执行 $name"
exec bash "$file"
}
show_menu() {
clear 2>/dev/null || true
echo -e "${CYAN}========================================${NC}"
echo -e "${CYAN} 顶尖协议一键脚本 / mjjtop proxy${NC}"
echo -e "${CYAN}========================================${NC}"
echo "1) ss2022 + shadowtls"
echo "2) anytls"
echo "3) snell v5"
echo "4) Reality (Xray)"
echo "0) 退出"
echo
}
case "${1:-}" in
ss|ss2022|shadowtls) run_remote "ss2022 + shadowtls" "ss2022-shadowtls.sh" ;;
anytls|any) run_remote "anytls" "anytls.sh" ;;
snell|snell5) run_remote "snell v5" "snell-v5.sh" ;;
reality|xray) run_remote "Reality (Xray)" "reality.sh" ;;
"") ;;
*) err "未知参数:$1,可用: ss | anytls | snell | reality" ;;
esac
while true; do
show_menu
read -rp "请选择协议 [0-4]: " choice
case "$choice" in
1) run_remote "ss2022 + shadowtls" "ss2022-shadowtls.sh" ;;
2) run_remote "anytls" "anytls.sh" ;;
3) run_remote "snell v5" "snell-v5.sh" ;;
4) run_remote "Reality (Xray)" "reality.sh" ;;
0|q|Q) exit 0 ;;
*) warn "无效选择"; sleep 1 ;;
esac
done