【彻底告别买VPS】免费节点的终极形态!0元白嫖 CodeSandbox 搭建 Xray 节点!免域名/免服务器,一键脚本3分钟搞定!
视频教程
codesandbox官网【点击前往】
实测配置数据:
操作系统:Debian,内核版本 Linux 6.1.43
CPU:AMD EPYC 四核心,主频 3.1GHz
内存:8G,当前已用 3.3G
磁盘空间:总容量 30G,已使用 14G
一键脚本(自动部署 + 抓取临时域名)
在 CodeSandbox 的终端(zsh)中直接粘贴并运行以下整合脚本:
# 1. 创建并进入工作目录
mkdir -p ~/xray && cd ~/xray
# 2. 下载并解压 Xray 核心(如已存在则跳过)
if [ ! -f "xray" ]; then
curl -L -o xray.zip https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip
unzip -o xray.zip
fi
# 3. 下载 cloudflared 临时隧道客户端(如已存在则跳过)
if [ ! -f "cloudflared" ]; then
curl -L -o cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
chmod +x cloudflared
fi
# 4. 清理残留进程
pkill -f xray
pkill -f cloudflared
# 5. 自动生成包含 "decryption": "none" 的标准 Xray 配置文件与随机 UUID
python3 -c "
import uuid, json
new_uuid = str(uuid.uuid4())
config = {
'inbounds': [{
'port': 8080,
'protocol': 'vless',
'settings': {
'clients': [{'id': new_uuid}],
'decryption': 'none'
},
'streamSettings': {
'network': 'ws',
'wsSettings': {'path': '/ws'}
}
}],
'outbounds': [{'protocol': 'freedom'}]
}
with open('config.json', 'w') as f:
json.dump(config, f, indent=2)
print('NEW_UUID=' + new_uuid)
" > /tmp/xray_env.sh
source /tmp/xray_env.sh
# 6. 后台启动 Xray 核心服务
nohup ./xray run -config config.json >/dev/null 2>&1 &
# 7. 后台启动 Cloudflare 临时隧道(转发本地 8080 端口)
rm -f cloudflared.log
nohup ./cloudflared tunnel --url http://localhost:8080 > cloudflared.log 2>&1 &
echo "⏳ 正在生成 Cloudflare 临时隧道域名,请稍等 5 秒..."
sleep 5
# 8. 自动抓取分配到的 trycloudflare.com 临时域名并输出节点链接
DOMAIN=$(grep -oE 'https://[a-zA-Z0-9-]+\.trycloudflare\.com' cloudflared.log | head -n 1 | sed 's|https://||')
if [ -n "$DOMAIN" ]; then
echo "=========================================================="
echo "🎉 部署成功!"
echo "🔗 分配的临时域名:${DOMAIN}"
echo "🔑 本次生成的 UUID:${NEW_UUID}"
echo "=========================================================="
echo "👉 最新 VLESS 一键导入链接:"
echo "vless://${NEW_UUID}@${DOMAIN}:443?encryption=none&security=tls&type=ws&host=${DOMAIN}&sni=${DOMAIN}&path=%2Fws#CF-QuickTunnel-Node"
echo "=========================================================="
else
echo "❌ 临时域名提取超时,请手动输入 cat ~/xray/cloudflared.log 查看日志"
fi
维护与状态查看
检查进程状态:
ps aux | grep -E 'xray|cloudflared'
重启临时隧道(会更新域名):
pkill -f cloudflared
rm -f ~/xray/cloudflared.log
cd ~/xray && nohup ./cloudflared tunnel --url http://localhost:8080 > cloudflared.log 2>&1 &
sleep 5
cat ~/xray/cloudflared.log | grep trycloudflare.com
v2rayN下载【点击前往】
批节点生成器【点击生成】
优选域名【点击前往】
本地优选【点击下载】
保活脚本
在终端中运行一个后台 Shell 脚本,每隔一段时间请求一次本地 Xray 端口或外部网络。这样可以产生持续的系统与网络活动:
nohup bash -c 'while true; do curl -s http://localhost:8080/ws > /dev/null; sleep 120; done' >/dev/null 2>&1 &
查看保活进程是否在运行:
ps aux | grep "while true"
手动停止保活进程:
pkill -f "while true"
# 在终端末尾追加保活
nohup bash -c 'while true; do curl -s http://localhost:8080/ws > /dev/null; sleep 120; done' >/dev/null 2>&1 &
注意事项
更多资源分享链接
海外网赚走资系列
https://youtube.com/playlist?list=PLU5ZBgZNBmfLOIMi-NfhVevAqI0ou6DLu&si=_nM8YlIin5GAlIPp
永久免费VPN合集
https://www.youtube.com/playlist?list=PLull5C8Cu9seW365SMm_BRFcdIhMCnZCW
合集1
https://www.youtube.com/playlist?list=PLull5C8Cu9sdMqVZHHC-2ySQ_p0k1EDiq
合集2
https://www.youtube.com/playlist?list=PLull5C8Cu9sdZM1gk851ZMDhH37n04VLZ
合集1
https://www.youtube.com/playlist?list=PLull5C8Cu9sduNjDlZHcM8taPl6oCV5S1
合集2
https://www.youtube.com/playlist?list=PLull5C8Cu9sc72ZKMd9sZ5nVFxa8lVP9e
0 评论