151 lines
3.5 KiB
Bash
151 lines
3.5 KiB
Bash
#!/bin/bash
|
|
|
|
wget https://github.com/XTLS/Xray-core/releases/download/v1.8.4/Xray-linux-64.zip
|
|
sudo apt install unzip -y
|
|
sudo mkdir /opt/xray
|
|
sudo unzip ./Xray-linux-64.zip -d /opt/xray
|
|
sudo chmod +x /opt/xray/xray
|
|
|
|
sudo cat << EOF > /usr/lib/systemd/system/xray.service
|
|
[Unit]
|
|
Description=Xray Service
|
|
Documentation=https://github.com/xtls
|
|
After=network.target nss-lookup.target
|
|
|
|
[Service]
|
|
User=nobody
|
|
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
NoNewPrivileges=true
|
|
ExecStart=/opt/xray/xray run -config /opt/xray/config.json
|
|
Restart=on-failure
|
|
RestartPreventExitStatus=23
|
|
LimitNPROC=10000
|
|
LimitNOFILE=1000000
|
|
LogLevelMax=4
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
sites=("amd" "intel" "apple" "microsoft" "ubuntu")
|
|
random_index=$((RANDOM % ${#sites[@]}))
|
|
RANDOM_SITE=${sites[$random_index]}
|
|
|
|
UUID=$(/opt/xray/xray uuid)
|
|
KEYS=$(/opt/xray/xray x25519)
|
|
PRIVATE=$(echo $KEYS | awk '{print $3}')
|
|
PUBLIC=$(echo $KEYS | awk '{print $6}')
|
|
SHORT=$(openssl rand -hex 8)
|
|
MAIL=$(hostname)
|
|
IP=$(ip r get 8.8.8.8 | awk '{print $7}')
|
|
|
|
sudo cat << EOF > /opt/xray/config.json
|
|
{
|
|
"log": {
|
|
"loglevel": "warning"
|
|
},
|
|
"routing": {
|
|
"domainStrategy": "IPIfNonMatch",
|
|
"rules": [
|
|
{
|
|
"type": "field",
|
|
"ip": [
|
|
"geoip:private"
|
|
],
|
|
"outboundTag": "block"
|
|
},
|
|
{
|
|
"type": "field",
|
|
"ip": ["geoip:ru"],
|
|
"outboundTag": "block"
|
|
},
|
|
{
|
|
"type": "field",
|
|
"domain": [
|
|
"geosite:category-ads-all"
|
|
],
|
|
"outboundTag": "block"
|
|
}
|
|
]
|
|
},
|
|
"inbounds": [
|
|
{
|
|
"port": 443,
|
|
"protocol": "vless",
|
|
"tag": "vless_tls",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"id": "$UUID",
|
|
"email": "$USER@$MAIL",
|
|
"flow": "xtls-rprx-vision"
|
|
}
|
|
],
|
|
"decryption": "none"
|
|
},
|
|
"streamSettings": {
|
|
"network": "tcp",
|
|
"security": "reality",
|
|
"realitySettings": {
|
|
"show": false,
|
|
"dest": "www.$RANDOM_SITE.com:443",
|
|
"xver": 0,
|
|
"serverNames": [
|
|
"www.$RANDOM_SITE.com"
|
|
],
|
|
"privateKey": "$PRIVATE",
|
|
"minClientVer": "",
|
|
"maxClientVer": "",
|
|
"maxTimeDiff": 0,
|
|
"shortIds": [
|
|
"$SHORT"
|
|
]
|
|
}
|
|
},
|
|
"sniffing": {
|
|
"enabled": true,
|
|
"destOverride": [
|
|
"http",
|
|
"tls"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"outbounds": [
|
|
{
|
|
"protocol": "freedom",
|
|
"tag": "direct"
|
|
},
|
|
{
|
|
"protocol": "blackhole",
|
|
"tag": "block"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
|
|
sudo systemctl start xray
|
|
sudo systemctl enable xray
|
|
|
|
echo "Клиент https://github.com/MatsuriDayo/nekoray/releases"
|
|
echo ""
|
|
echo "ПАРАМЕТРЫ ДЛЯ НАСТРОЙКИ ПРИЛОЖЕНИЯ. СОХРАНИТЕ ИХ!!!"
|
|
echo "Название: Любое"
|
|
echo "Адрес: $IP"
|
|
echo "Порт: 443"
|
|
echo "ID: $UUID"
|
|
echo "Поток: xtls-rprx-vision"
|
|
echo "Шифрование: none"
|
|
echo "Сеть: tcp"
|
|
echo "Тип заголовка: none"
|
|
echo "Узел HTTP и Путь пустые"
|
|
echo "TLS: reality"
|
|
echo "SNI www.$RANDOM_SITE.com"
|
|
echo "ОТПЕЧАТОК: Chrome"
|
|
echo "ОТКРЫТЫЙ КЛЮЧ: $PUBLIC"
|
|
echo "ShortID: $SHORT"
|
|
echo "SpiderX: Пусто"
|
|
echo ""
|
|
echo "ТАКЖЕ МОЖНО ПРОСТО ИМПОРТИРОВАТЬ НАСТРОЙКИ ИЗ ДАННОЙ СТРОКИ"
|
|
echo "vless://$UUID@$IP:443?security=reality&encryption=none&pbk=$PUBLIC&headerType=none&fp=chrome&type=tcp&flow=xtls-rprx-vision&sni=www.$RANDOM_SITE.com&sid=$SHORT#VLESS%20HEILTZEENTCH"
|