49 lines
1.6 KiB
Bash
Executable File
49 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 顶尖协议一键脚本统一入口: ss2022+shadowtls / anytls / snell v5 / Reality
|
||
set -e
|
||
BASE_URL="${MIRROR_BASE_URL:-https://mjjtop.com/admin/proxy-installer/raw/branch/main}"
|
||
TMP_DIR="/tmp/mjjtop-proxy-installer"
|
||
mkdir -p "$TMP_DIR"
|
||
err(){ echo "[ERROR] $*" >&2; exit 1; }
|
||
info(){ echo "[INFO] $*"; }
|
||
[ "${PROXY_INSTALLER_SKIP_ROOT_CHECK:-0}" = "1" ] || [ "$(id -u)" = "0" ] || err "请用 root 运行"
|
||
command -v curl >/dev/null 2>&1 || err "缺少 curl,请先安装: apt install -y curl"
|
||
run_remote(){
|
||
name="$1"
|
||
script_path="$2"
|
||
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"
|
||
}
|
||
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
|
||
cat <<'MENU'
|
||
========================================
|
||
顶尖协议一键脚本 / mjjtop proxy
|
||
========================================
|
||
1) ss2022 + shadowtls
|
||
2) anytls
|
||
3) snell v5
|
||
4) Reality (Xray)
|
||
0) 退出
|
||
MENU
|
||
printf '请选择协议 [0-4]: '
|
||
read 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 ;;
|
||
*) err "无效选择" ;;
|
||
esac
|