文章详情

返回首页

自用 VLESS TCP REALITY Vision 最小脚本

分享文章 作者: Ws01 创建时间: 2026-01-11 更新时间: 2026-01-11 📝 字数: 4,208 字 👁️ 阅读: 46 次

自用 VLESS TCP REALITY Vision 最小脚本(Tesla 伪装 / 随机端口 / 可维护)gpt生成,绝无后门
本文转自:NS论坛
一、脚本特点(一句话)
VLESS + TCP + REALITY + Vision
默认 Tesla 伪装(www.tesla.com)
随机高端口(或手动指定)
官方 Xray 内核
不碰 iptables / WARP / Argo
systemd 管理,可随时卸载
目标很明确:
最小配置 + 最大可控 + 出问题能自己修

二、使用方式

1、创建rv.sh
cat > /root/rv.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
export LANG=en_US.UTF-8

# =========================
# 自用最小脚本:VLESS TCP REALITY Vision
# =========================

ENV_FILE="/root/reality_vision.env"
XRAY_BIN="/usr/local/bin/xray"
XRAY_CONF="/usr/local/etc/xray/config.json"
SERVICE="xray"

REYM_DEFAULT="www.tesla.com"
PORT_MIN=46000
PORT_MAX=65535

is_root() { [[ "${EUID}" -eq 0 ]]; }
is_port_free() { ss -lnt | awk '{print $4}' | grep -qE "[:.]$1$" && return 1 || return 0; }

install_deps() {
  apt-get update -y >/dev/null
  apt-get install -y curl unzip openssl ca-certificates iproute2 >/dev/null
}

install_xray() {
  bash <(curl -Ls https://github.com/XTLS/Xray-install/raw/main/install-release.sh) >/dev/null
}

gen_uuid() {
  UUID="${uuid:-$(cat /proc/sys/kernel/random/uuid)}"
}

choose_port() {
  if [[ -n "${vlpt:-}" ]]; then
    PORT="$vlpt"
  else
    PORT="$(shuf -i ${PORT_MIN}-${PORT_MAX} -n 1)"
  fi
}

gen_reality_keys() {
  local KEYS
  KEYS="$("$XRAY_BIN" x25519)"
  PRIVATE_KEY="$(echo "$KEYS" | awk -F'[: ]+' '/PrivateKey|Private key/ {print $2}')"
  PUBLIC_KEY="$(echo "$KEYS" | awk -F'[: ]+' '/Password|Public key/ {print $2}')"
  SHORT_ID="$(openssl rand -hex 4)"
}

write_config() {
mkdir -p /usr/local/etc/xray
cat > "$XRAY_CONF" <<JSON
{
  "inbounds": [{
    "listen": "0.0.0.0",
    "port": $PORT,
    "protocol": "vless",
    "settings": {
      "clients": [{ "id": "$UUID", "flow": "xtls-rprx-vision" }],
      "decryption": "none"
    },
    "streamSettings": {
      "network": "tcp",
      "security": "reality",
      "realitySettings": {
        "dest": "$SNI:443",
        "serverNames": ["$SNI"],
        "privateKey": "$PRIVATE_KEY",
        "shortIds": ["$SHORT_ID"]
      }
    }
  }],
  "outbounds": [{ "protocol": "freedom" }]
}
JSON
}

save_env() {
cat > "$ENV_FILE" <<ENV
SERVER_IP=$SERVER_IP
PORT=$PORT
UUID=$UUID
SNI=$SNI
PUBLIC_KEY=$PUBLIC_KEY
SHORT_ID=$SHORT_ID
ENV
chmod 600 "$ENV_FILE"
}

cmd_install() {
  is_root || exit 1
  install_deps
  install_xray

  SNI="${reym:-$REYM_DEFAULT}"
  gen_uuid
  choose_port
  gen_reality_keys

  SERVER_IP="$(curl -s https://api.ipify.org)"
  write_config

  systemctl enable xray >/dev/null
  systemctl restart xray

  save_env
  echo "安装完成,运行:bash rv.sh info"
}

cmd_info() {
  source "$ENV_FILE"
  echo "#############################################################"
  echo "vless://${UUID}@${SERVER_IP}:${PORT}?encryption=none&flow=xtls-rprx-vision&security=reality&sni=${SNI}&fp=chrome&pbk=${PUBLIC_KEY}&sid=${SHORT_ID}&type=tcp#RV-Tesla-Vision"
  echo "#############################################################"
}

cmd_uninstall() {
  systemctl stop xray || true
  systemctl disable xray || true
  rm -f "$XRAY_CONF" "$ENV_FILE"
  curl -Ls https://github.com/XTLS/Xray-install/raw/main/install-release.sh | bash -s -- remove
}

case "$1" in
  install) cmd_install ;;
  info) cmd_info ;;
  uninstall) cmd_uninstall ;;
  *) echo "用法: bash rv.sh install|info|uninstall" ;;
esac
EOF

2、赋予权限

chmod +x /root/rv.sh

3、运行脚本

bash /root/rv.sh install

或 运行自定义脚本【指定 伪装域名、指定 端口和指定 uuid】

reym=www.bing.com vlpt=49988 bash rv.sh install

4、查看配置

bash /root/rv.sh info

5、卸载 Xray

bash /root/rv.sh uninstall
三、注意事项(一定要看)

记得在云厂商安全组放行 TCP 端口

客户端务必填写:

flow:xtls-rprx-vision

fingerprint:chrome

SNI:与脚本一致

Reality 不需要证书,不走 CDN

适合 & 不适合

✅ 适合:
长期主力节点
想要干净 Reality
不想被一键脚本魔改系统

❌ 不适合:
想一台 VPS 跑十几种协议
完全不想理解原理

四、补充下指令和作用

# 安装并初始化 VLESS TCP REALITY Vision 节点
bash rv.sh install

# 输出当前节点的分享链接和关键信息
bash rv.sh info

# 停止并卸载 Xray,同时清理配置和保存信息
bash rv.sh uninstall

# 使用自定义参数重新安装(可选)
reym=www.tesla.com vlpt=443 uuid=xxxx bash rv.sh install

留言

暂无留言

0 / 100