自用 VLESS TCP REALITY Vision 最小脚本(Tesla 伪装 / 随机端口 / 可维护)gpt生成,绝无后门
本文转自:NS论坛
一、脚本特点(一句话)
VLESS + TCP + REALITY + Vision
默认 Tesla 伪装(www.tesla.com)
随机高端口(或手动指定)
官方 Xray 内核
不碰 iptables / WARP / Argo
systemd 管理,可随时卸载
目标很明确:
最小配置 + 最大可控 + 出问题能自己修
二、使用方式
1、创建rv.shcat > /root/rv.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
export LANG=en_US.UTF-8
=========================
自用最小脚本:VLESS TCP REALITY Vision
=========================
ENVFILE="/root/realityvision.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 ]]; }
isportfree() { 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 ${PORTMIN}-${PORTMAX} -n 1)"
fi
}
genrealitykeys() {
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
SERVERIP=$SERVERIP
PORT=$PORT
UUID=$UUID
SNI=$SNI
PUBLICKEY=$PUBLICKEY
SHORTID=$SHORTID
ENV
chmod 600 "$ENV_FILE"
}
cmd_install() {
is_root || exit 1
install_deps
install_xray
SNI="${reym:-$REYM_DEFAULT}"
gen_uuid
choose_port
genrealitykeys
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}@${SERVERIP}:${PORT}?encryption=none&flow=xtls-rprx-vision&security=reality&sni=${SNI}&fp=chrome&pbk=${PUBLICKEY}&sid=${SHORT_ID}&type=tcp#RV-Tesla-Vision"
echo "#############################################################"
}
cmd_uninstall() {
systemctl stop xray || true
systemctl disable xray || true
rm -f "$XRAYCONF" "$ENVFILE"
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
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