mirror of
https://github.com/xVRVx/autoXRAY.git
synced 2026-08-26 16:45:33 +00:00
1009 lines
30 KiB
Bash
1009 lines
30 KiB
Bash
#!/bin/bash
|
||
|
||
DOMAIN=$1
|
||
|
||
if [ -z "$DOMAIN" ]; then
|
||
echo "❌ Ошибка: домен не задан."
|
||
exit 1
|
||
fi
|
||
|
||
echo "Обновление и установка необходимых пакетов..."
|
||
apt update && apt install -y jq dnsutils
|
||
|
||
|
||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||
DNS_IP=$(dig +short "$DOMAIN" | grep '^[0-9]')
|
||
|
||
if [ "$LOCAL_IP" != "$DNS_IP" ]; then
|
||
echo "❌ Внимание: IP-адрес ($LOCAL_IP) не совпадает с A-записью $DOMAIN ($DNS_IP)."
|
||
echo "Правильно укажите одну A-запись для вашего домена в ДНС - $LOCAL_IP"
|
||
|
||
read -p "Продолжить на ваш страх и риск? (y/N): " choice
|
||
if [[ ! "$choice" =~ ^[Yy]$ ]]; then
|
||
echo "Выполнение скрипта прервано."
|
||
exit 1
|
||
fi
|
||
echo "Продолжение выполнения скрипта..."
|
||
fi
|
||
|
||
|
||
apt install nginx -y
|
||
|
||
systemctl enable --now nginx
|
||
|
||
apt install certbot -y
|
||
|
||
mkdir -p /var/lib/xray/cert/
|
||
|
||
### Проверить
|
||
cp /etc/letsencrypt/live/$DOMAIN/fullchain.pem /var/lib/xray/cert/fullchain.pem
|
||
cp /etc/letsencrypt/live/$DOMAIN/privkey.pem /var/lib/xray/cert/privkey.pem
|
||
chmod 744 /var/lib/xray/cert/privkey.pem
|
||
chmod 744 /var/lib/xray/cert/fullchain.pem
|
||
|
||
certbot certonly --webroot -w /var/www/html -d $DOMAIN -m mail@$DOMAIN --agree-tos --non-interactive --deploy-hook "systemctl reload nginx; cp /etc/letsencrypt/live/$DOMAIN/fullchain.pem /var/lib/xray/cert/fullchain.pem; cp /etc/letsencrypt/live/$DOMAIN/privkey.pem /var/lib/xray/cert/privkey.pem; chmod 744 /var/lib/xray/cert/privkey.pem; chmod 744 /var/lib/xray/cert/fullchain.pem; systemctl restart xray"
|
||
|
||
CONFIG_PATH="/etc/nginx/sites-available/default"
|
||
|
||
path_xhttp=$(openssl rand -base64 15 | tr -dc 'a-z0-9' | head -c 6)
|
||
|
||
echo "✅ Записываем конфигурацию в $CONFIG_PATH для домена $DOMAIN"
|
||
|
||
bash -c "cat > $CONFIG_PATH" <<EOF
|
||
server {
|
||
server_name $DOMAIN;
|
||
#listen 3333 ssl http2 proxy_protocol;
|
||
listen unix:/dev/shm/nginx.sock proxy_protocol;
|
||
listen unix:/dev/shm/nginx_h2.sock http2 proxy_protocol;
|
||
set_real_ip_from unix:;
|
||
real_ip_header proxy_protocol;
|
||
|
||
root /var/www/$DOMAIN;
|
||
index index.php index.html;
|
||
|
||
# grpc settings
|
||
grpc_read_timeout 1h;
|
||
grpc_send_timeout 1h;
|
||
grpc_set_header X-Real-IP \$remote_addr;
|
||
|
||
add_header profile-title "base64:YXV0b1hSQVk=";
|
||
add_header routing "happ://routing/onadd/ewogICAgIk5hbWUiOiAiYXV0b1hSQVkiLAogICAgIkdsb2JhbFByb3h5IjogInRydWUiLAogICAgIlVzZUNodW5rRmlsZXMiOiAidHJ1ZSIsCiAgICAiUmVtb3RlRE5TVHlwZSI6ICJEb0giLAogICAgIlJlbW90ZUROU0RvbWFpbiI6ICIiLAogICAgIlJlbW90ZUROU0lQIjogIiIsCiAgICAiRG9tZXN0aWNETlNUeXBlIjogIkRvSCIsCiAgICAiRG9tZXN0aWNETlNEb21haW4iOiAiIiwKICAgICJEb21lc3RpY0ROU0lQIjogIiIsCiAgICAiR2VvaXB1cmwiOiAiIiwKICAgICJHZW9zaXRldXJsIjogIiIsCiAgICAiTGFzdFVwZGF0ZWQiOiAiIiwKICAgICJEbnNIb3N0cyI6IHt9LAogICAgIk9yZGVyUm91dGluZyI6ICJibG9jay1kaXJlY3QtcHJveHkiLAogICAgIkRpcmVjdFNpdGVzIjogWwogICAgICAgICJjYXRlZ29yeS1ydSIsCiAgICAgICAgImdlb3NpdGU6cHJpdmF0ZSIKICAgIF0sCiAgICAiRGlyZWN0SXAiOiBbCiAgICAgICAgImdlb2lwOnByaXZhdGUiCiAgICBdLAogICAgIlByb3h5U2l0ZXMiOiBbXSwKICAgICJQcm94eUlwIjogW10sCiAgICAiQmxvY2tTaXRlcyI6IFsKICAgICAgICAiZ2Vvc2l0ZTpjYXRlZ29yeS1hZHMiLAogICAgICAgICJnZW9zaXRlOndpbi1zcHkiCiAgICBdLAogICAgIkJsb2NrSXAiOiBbXSwKICAgICJEb21haW5TdHJhdGVneSI6ICJJUElmTm9uTWF0Y2giLAogICAgIkZha2VETlMiOiAiZmFsc2UiCn0=";
|
||
add_header routing-enable 0;
|
||
|
||
location /${path_xhttp} {
|
||
proxy_pass http://127.0.0.1:8400;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host \$host;
|
||
}
|
||
location /${path_xhttp}11 {
|
||
if (\$request_method != "POST") {
|
||
return 404;
|
||
}
|
||
client_body_buffer_size 1m;
|
||
client_body_timeout 1h;
|
||
client_max_body_size 0;
|
||
grpc_pass grpc://127.0.0.1:8411;
|
||
|
||
}
|
||
|
||
location ~ /\.ht {
|
||
deny all;
|
||
}
|
||
}
|
||
|
||
server {
|
||
listen 80;
|
||
server_name $DOMAIN;
|
||
|
||
location /.well-known/acme-challenge/ {
|
||
root /var/www/html;
|
||
}
|
||
|
||
location / {
|
||
return 301 https://\$host\$request_uri;
|
||
}
|
||
}
|
||
EOF
|
||
|
||
echo "✅ Конфигурация nginx обновлена."
|
||
|
||
systemctl restart nginx
|
||
|
||
|
||
# Создание директории
|
||
WEB_PATH="/var/www/$DOMAIN"
|
||
mkdir -p "$WEB_PATH"
|
||
|
||
# Установка прав
|
||
#chown -R $USER:$USER "$WEB_PATH"
|
||
#chmod -R 755 "$WEB_PATH"
|
||
|
||
# Arrays with random options
|
||
TITLES=("FileShare" "CloudBox" "DataVault" "SecureShare" "EasyFiles" "QuickAccess" "VaultZone" "SkyDrive" "SafeData" "FlexShare"
|
||
"DropZone" "SecureStorage" "FastFiles" "SharePoint" "MegaVault" "Boxify" "DataBank" "DriveSecure" "FileStream" "AccessHub")
|
||
|
||
HEADERS=("Welcome to FileShare" "Login to Your CloudBox" "Enter Your Secure Vault" "Access Your DataVault" "Sign in to EasyFiles"
|
||
"Connect to QuickAccess" "Welcome to VaultZone" "Login to SkyDrive" "Enter Your SafeData" "Sign in to FlexShare"
|
||
"Access Your DropZone" "Welcome to SecureStorage" "Login to FastFiles" "Enter Your SharePoint" "Welcome to MegaVault"
|
||
"Sign in to Boxify" "Access Your DataBank" "Welcome to DriveSecure" "Login to FileStream" "Connect to AccessHub")
|
||
|
||
BUTTON_COLORS=("bg-blue-600" "bg-green-600" "bg-red-600" "bg-yellow-600" "bg-purple-600" "bg-pink-600" "bg-indigo-600"
|
||
"bg-teal-600" "bg-orange-600" "bg-cyan-600" "bg-lime-600" "bg-amber-600" "bg-fuchsia-600" "bg-violet-600"
|
||
"bg-rose-600" "bg-emerald-600" "bg-sky-600" "bg-gray-600" "bg-zinc-600" "bg-stone-600")
|
||
|
||
BUTTON_TEXTS=("Sign In" "Log In" "Login" "Access Account" "Enter Account"
|
||
"Sign In to Continue" "Sign In to Dashboard" "Log In to Your Account" "Continue to Account" "Access Your Dashboard"
|
||
"Let’s Go" "Welcome Back!" "Get Started" "Join Us Again" "Back Again? Sign In"
|
||
"Secure Sign In" "Protected Login" "Sign In Securely"
|
||
"Enter" "Go")
|
||
|
||
# Random selection
|
||
TITLE=${TITLES[$RANDOM % ${#TITLES[@]}]}
|
||
HEADER=${HEADERS[$RANDOM % ${#HEADERS[@]}]}
|
||
BUTTON_COLOR=${BUTTON_COLORS[$RANDOM % ${#BUTTON_COLORS[@]}]}
|
||
BUTTON_TEXT=${BUTTON_TEXTS[$RANDOM % ${#BUTTON_TEXTS[@]}]}
|
||
|
||
echo "✅ Creating index.html at $WEB_PATH"
|
||
|
||
# Generate HTML content
|
||
cat > "$WEB_PATH/index.html" <<EOF
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>$TITLE</title>
|
||
<script src="https://cdn.tailwindcss.com"></script>
|
||
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
|
||
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js" integrity="sha256-9zljDKpE/mQxmaR4V2cGVaQ7arF3CcXxarvgr7Sj8Uc=" crossorigin="anonymous"></script>
|
||
</head>
|
||
<body class="flex items-center justify-center min-h-screen bg-gray-100">
|
||
<div class="w-full max-w-md p-8 space-y-6 bg-white rounded-2xl shadow-md">
|
||
<h2 class="text-2xl font-bold text-center text-gray-700">$HEADER</h2>
|
||
<form action="#" method="POST" class="space-y-4">
|
||
<div>
|
||
<label for="login" class="block text-sm font-medium text-gray-600">Username</label>
|
||
<input type="text" id="login" name="login" class="w-full p-2 mt-1 border rounded-lg focus:ring focus:ring-blue-200" />
|
||
</div>
|
||
<div>
|
||
<label for="password" class="block text-sm font-medium text-gray-600">Password</label>
|
||
<input type="password" id="password" name="password" class="w-full p-2 mt-1 border rounded-lg focus:ring focus:ring-blue-200" />
|
||
</div>
|
||
<button type="submit" class="w-full px-4 py-2 text-white $BUTTON_COLOR rounded-lg hover:opacity-90 focus:ring focus:ring-blue-200">
|
||
$BUTTON_TEXT
|
||
</button>
|
||
</form>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
EOF
|
||
|
||
|
||
|
||
# Установка Xray
|
||
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
|
||
|
||
|
||
# Определяем директорию скрипта
|
||
#SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||
SCRIPT_DIR=/usr/local/etc/xray
|
||
|
||
# Генерируем переменные
|
||
xray_uuid_vrv=$(xray uuid)
|
||
|
||
key_output=$(xray x25519)
|
||
xray_privateKey_vrv=$(echo "$key_output" | awk -F': ' '/PrivateKey/ {print $2}')
|
||
xray_publicKey_vrv=$(echo "$key_output" | awk -F': ' '/Password/ {print $2}')
|
||
|
||
key_mldsa65=$(xray mldsa65)
|
||
seed_mldsa65=$(echo "$key_mldsa65" | awk -F': ' '/Seed/ {print $2}')
|
||
verify_mldsa65=$(echo "$key_mldsa65" | awk -F': ' '/Verify/ {print $2}')
|
||
|
||
xray_shortIds_vrv=$(openssl rand -hex 8)
|
||
|
||
# xray_sspasw_vrv=$(openssl rand -base64 15 | tr -dc 'A-Za-z0-9' | head -c 20)
|
||
xray_sspasw_vrv=$(openssl rand -base64 32)
|
||
|
||
path_subpage=$(openssl rand -base64 15 | tr -dc 'A-Za-z0-9' | head -c 20)
|
||
|
||
socksUser=$(openssl rand -base64 20 | tr -dc 'A-Za-z0-9' | head -c 5)
|
||
socksPasw=$(openssl rand -base64 20 | tr -dc 'A-Za-z0-9' | head -c 10)
|
||
|
||
# ipserv=$(hostname -I | awk '{print $1}')
|
||
|
||
|
||
|
||
# Экспортируем переменные для envsubst
|
||
export xray_uuid_vrv xray_privateKey_vrv xray_publicKey_vrv xray_shortIds_vrv xray_sspasw_vrv DOMAIN path_subpage path_xhttp WEB_PATH socksUser socksPasw
|
||
|
||
# Создаем JSON конфигурацию сервера
|
||
cat << 'EOF' | envsubst > "$SCRIPT_DIR/config.json"
|
||
{
|
||
"log": {
|
||
"dnsLog": false,
|
||
"access": "/var/log/xray/access.log",
|
||
"error": "/var/log/xray/error.log",
|
||
"loglevel": "none"
|
||
},
|
||
"dns": {
|
||
"servers": [
|
||
"https+local://8.8.4.4/dns-query",
|
||
"https+local://8.8.8.8/dns-query",
|
||
"https+local://1.1.1.1/dns-query",
|
||
"localhost"
|
||
],
|
||
"queryStrategy": "UseIPv4"
|
||
},
|
||
"inbounds": [
|
||
{
|
||
"tag": "vsTCPxtls",
|
||
"port": 443,
|
||
"listen": "0.0.0.0",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"clients": [
|
||
{
|
||
"flow": "xtls-rprx-vision",
|
||
"id": "${xray_uuid_vrv}"
|
||
}
|
||
],
|
||
"decryption": "none",
|
||
"fallbacks": [
|
||
{
|
||
"path": "/${path_xhttp}22",
|
||
"dest": "@vless-ws",
|
||
"xver": 2
|
||
},
|
||
{
|
||
"path": "/${path_xhttp}33",
|
||
"dest": "@vless-tcp",
|
||
"xver": 2
|
||
},
|
||
{
|
||
"alpn": "h2",
|
||
"dest": "/dev/shm/nginx_h2.sock",
|
||
"xver": 2
|
||
},
|
||
{
|
||
"dest": "/dev/shm/nginx.sock",
|
||
"xver": 2
|
||
}
|
||
]
|
||
},
|
||
"streamSettings": {
|
||
"network": "raw",
|
||
"security": "tls",
|
||
"tlsSettings": {
|
||
"certificates": [
|
||
{
|
||
"certificateFile": "/var/lib/xray/cert/fullchain.pem",
|
||
"keyFile": "/var/lib/xray/cert/privkey.pem"
|
||
}
|
||
],
|
||
"minVersion": "1.2",
|
||
"cipherSuites": "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
||
"alpn": [
|
||
"h2", "http/1.1"
|
||
]
|
||
}
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "vsXHTTPtls",
|
||
"port": 8400,
|
||
"listen": "127.0.0.1",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"clients": [
|
||
{
|
||
"id": "${xray_uuid_vrv}"
|
||
}
|
||
],
|
||
"decryption": "none"
|
||
},
|
||
"streamSettings": {
|
||
"network": "xhttp",
|
||
"xhttpSettings": {
|
||
"mode": "auto",
|
||
"path": "/${path_xhttp}"
|
||
},
|
||
"security": "none",
|
||
"sockopt": {
|
||
"acceptProxyProtocol": false
|
||
}
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "vsGRPCtls",
|
||
"port": 8411,
|
||
"listen": "127.0.0.1",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"clients": [
|
||
{
|
||
"id": "${xray_uuid_vrv}"
|
||
}
|
||
],
|
||
"decryption": "none"
|
||
},
|
||
"streamSettings": {
|
||
"network": "grpc",
|
||
"grpcSettings": {
|
||
"serviceName": "${path_xhttp}11"
|
||
},
|
||
"security": "none"
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"listen": "@vless-ws",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"clients": [
|
||
{
|
||
"id": "${xray_uuid_vrv}"
|
||
}
|
||
],
|
||
"decryption": "none"
|
||
},
|
||
"streamSettings": {
|
||
"network": "ws",
|
||
"wsSettings": {
|
||
"acceptProxyProtocol": true,
|
||
"path": "/${path_xhttp}22"
|
||
},
|
||
"security": "none"
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"listen": "@vless-tcp",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"clients": [
|
||
{
|
||
"id": "${xray_uuid_vrv}"
|
||
}
|
||
],
|
||
"decryption": "none"
|
||
},
|
||
"streamSettings": {
|
||
"network": "raw",
|
||
"security": "none",
|
||
"rawSettings": {
|
||
"acceptProxyProtocol": true,
|
||
"header": {
|
||
"type": "http",
|
||
"request": {
|
||
"path": [
|
||
"/${path_xhttp}33"
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "ShadowSocks2022",
|
||
"port": 8443,
|
||
"listen": "0.0.0.0",
|
||
"protocol": "shadowsocks",
|
||
"settings": {
|
||
"method": "2022-blake3-aes-256-gcm",
|
||
"password": "${xray_sspasw_vrv}",
|
||
"network": "tcp,udp"
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "socks5",
|
||
"port": 10443,
|
||
"listen": "0.0.0.0",
|
||
"protocol": "mixed",
|
||
"settings": {
|
||
"ip": "0.0.0.0",
|
||
"udp": true,
|
||
"auth": "password",
|
||
"accounts": [
|
||
{
|
||
"user": "${socksUser}",
|
||
"pass": "${socksPasw}"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
],
|
||
"outbounds": [
|
||
{
|
||
"tag": "direct",
|
||
"protocol": "freedom",
|
||
"settings": {
|
||
"domainStrategy": "ForceIPv4"
|
||
}
|
||
},
|
||
{
|
||
"tag": "block",
|
||
"protocol": "blackhole"
|
||
},
|
||
{
|
||
"tag": "warp",
|
||
"protocol": "socks",
|
||
"settings": {
|
||
"servers": [
|
||
{
|
||
"address": "127.0.0.1",
|
||
"port": 40000
|
||
}
|
||
]
|
||
}
|
||
}
|
||
],
|
||
"routing": {
|
||
"rules": [
|
||
{
|
||
"ip": [
|
||
"geoip:private"
|
||
],
|
||
"outboundTag": "block"
|
||
},
|
||
{
|
||
"protocol": [
|
||
"bittorrent"
|
||
],
|
||
"outboundTag": "block"
|
||
},
|
||
{
|
||
"domain": [
|
||
"geosite:category-ads",
|
||
"geosite:win-spy",
|
||
"geosite:private"
|
||
],
|
||
"outboundTag": "block"
|
||
},
|
||
{
|
||
"outboundTag": "direct",
|
||
"domain": ["geosite:google-gemini","geosite:category-ru","habr.com"]
|
||
}
|
||
],
|
||
"domainStrategy": "IPIfNonMatch"
|
||
}
|
||
}
|
||
|
||
EOF
|
||
|
||
# Создаем JSON конфигурацию клиента
|
||
print_config() {
|
||
local PROXY_OUTBOUND="$1"
|
||
local REMARK="$2"
|
||
|
||
cat << TPL
|
||
{
|
||
"log": {
|
||
"loglevel": "warning"
|
||
},
|
||
"dns": {
|
||
"servers": [
|
||
"https://8.8.4.4/dns-query",
|
||
"https://8.8.8.8/dns-query",
|
||
"https://1.1.1.1/dns-query"
|
||
],
|
||
"queryStrategy": "UseIPv4"
|
||
},
|
||
"routing": {
|
||
"domainStrategy": "IPIfNonMatch",
|
||
"rules": [
|
||
{
|
||
"domain": [
|
||
"geosite:category-ads",
|
||
"geosite:win-spy"
|
||
],
|
||
"outboundTag": "block"
|
||
},
|
||
{
|
||
"protocol": [
|
||
"bittorrent"
|
||
],
|
||
"outboundTag": "direct"
|
||
},
|
||
{
|
||
"domain": [
|
||
"habr.com"
|
||
],
|
||
"outboundTag": "proxy"
|
||
},
|
||
{
|
||
"domain": [
|
||
"geosite:private",
|
||
"geosite:apple",
|
||
"geosite:google-play",
|
||
"geosite:yandex",
|
||
"geosite:vk",
|
||
"geosite:category-ru"
|
||
],
|
||
"outboundTag": "direct"
|
||
},
|
||
{
|
||
"ip": [
|
||
"geoip:private"
|
||
],
|
||
"outboundTag": "direct"
|
||
}
|
||
]
|
||
},
|
||
"inbounds": [
|
||
{
|
||
"tag": "socks-in",
|
||
"protocol": "socks",
|
||
"listen": "127.0.0.1",
|
||
"port": 10808,
|
||
"settings": {
|
||
"udp": true
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "socks-sb",
|
||
"protocol": "socks",
|
||
"listen": "127.0.0.1",
|
||
"port": 2080,
|
||
"settings": {
|
||
"udp": true
|
||
},
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"tag": "http-in",
|
||
"protocol": "http",
|
||
"listen": "127.0.0.1",
|
||
"port": 10809,
|
||
"sniffing": {
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls",
|
||
"quic"
|
||
]
|
||
}
|
||
}
|
||
],
|
||
"outbounds": [
|
||
$PROXY_OUTBOUND,
|
||
{
|
||
"tag": "direct",
|
||
"protocol": "freedom"
|
||
},
|
||
{
|
||
"tag": "block",
|
||
"protocol": "blackhole"
|
||
}
|
||
],
|
||
"remarks": "$REMARK"
|
||
}
|
||
TPL
|
||
}
|
||
|
||
# --- 1. VLESS TCP XTLS-Vision (Основной, самый быстрый) ---
|
||
OUT_VISION='{
|
||
"tag": "proxy",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"vnext": [{
|
||
"address": "$DOMAIN",
|
||
"port": 443,
|
||
"users": [{ "id": "${xray_uuid_vrv}", "flow": "xtls-rprx-vision", "encryption": "none" }]
|
||
}]
|
||
},
|
||
"streamSettings": {
|
||
"network": "raw",
|
||
"security": "tls",
|
||
"tlsSettings": {
|
||
"serverName": "$DOMAIN",
|
||
"fingerprint": "chrome"
|
||
}
|
||
}
|
||
}'
|
||
|
||
# --- 2. VLESS XHTTP (Через Fallback Nginx) ---
|
||
OUT_XHTTP='{
|
||
"tag": "proxy",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"vnext": [{
|
||
"address": "$DOMAIN",
|
||
"port": 443,
|
||
"users": [{ "id": "${xray_uuid_vrv}", "encryption": "none" }]
|
||
}]
|
||
},
|
||
"streamSettings": {
|
||
"network": "xhttp",
|
||
"xhttpSettings": {
|
||
"extra": {
|
||
"headers": {
|
||
},
|
||
"noGRPCHeader": false,
|
||
"scMaxEachPostBytes": 1500000,
|
||
"scMinPostsIntervalMs": 20,
|
||
"scStreamUpServerSecs": "60-240",
|
||
"xPaddingBytes": "400-800",
|
||
"xmux": {
|
||
"cMaxReuseTimes": "1000-3000",
|
||
"hKeepAlivePeriod": 0,
|
||
"hMaxRequestTimes": "400-700",
|
||
"hMaxReusableSecs": "1200-1800",
|
||
"maxConcurrency": "3-5",
|
||
"maxConnections": 0
|
||
}
|
||
},
|
||
"mode": "auto", "path": "/${path_xhttp}" },
|
||
"security": "tls",
|
||
"tlsSettings": { "serverName": "$DOMAIN", "fingerprint": "chrome" }
|
||
}
|
||
}'
|
||
|
||
# --- 3. VLESS gRPC (Через Fallback Nginx) ---
|
||
# Важно: alpn h2 обязателен для корректной работы через Nginx
|
||
OUT_GRPC='{
|
||
"tag": "proxy",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"vnext": [{
|
||
"address": "$DOMAIN",
|
||
"port": 443,
|
||
"users": [{ "id": "${xray_uuid_vrv}", "encryption": "none" }]
|
||
}]
|
||
},
|
||
"streamSettings": {
|
||
"network": "grpc",
|
||
"grpcSettings": { "serviceName": "${path_xhttp}11", "multiMode": false },
|
||
"security": "tls",
|
||
"tlsSettings": { "serverName": "$DOMAIN", "alpn": ["h2"], "fingerprint": "chrome" }
|
||
}
|
||
}'
|
||
|
||
# --- 4. VLESS WebSocket (Внутренний Fallback Xray path...22) ---
|
||
OUT_WS='{
|
||
"tag": "proxy",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"vnext": [{
|
||
"address": "$DOMAIN",
|
||
"port": 443,
|
||
"users": [{ "id": "${xray_uuid_vrv}", "encryption": "none" }]
|
||
}]
|
||
},
|
||
"streamSettings": {
|
||
"network": "ws",
|
||
"wsSettings": { "path": "/${path_xhttp}22" },
|
||
"security": "tls",
|
||
"tlsSettings": { "serverName": "$DOMAIN", "fingerprint": "chrome" }
|
||
}
|
||
}'
|
||
|
||
# --- 5. VLESS TCP Header (Внутренний Fallback Xray path...33) ---
|
||
OUT_TCP_HTTP='{
|
||
"mux": {
|
||
"concurrency": 5,
|
||
"enabled": true,
|
||
"xudpConcurrency": 8,
|
||
"xudpProxyUDP443": "allow"
|
||
},
|
||
"tag": "proxy",
|
||
"protocol": "vless",
|
||
"settings": {
|
||
"vnext": [{
|
||
"address": "$DOMAIN",
|
||
"port": 443,
|
||
"users": [{ "id": "${xray_uuid_vrv}", "encryption": "none" }]
|
||
}]
|
||
},
|
||
"streamSettings": {
|
||
"network": "raw",
|
||
"rawSettings": {
|
||
"header": { "type": "http", "request": { "path": ["/${path_xhttp}33"] } }
|
||
},
|
||
"security": "tls",
|
||
"tlsSettings": { "serverName": "$DOMAIN", "fingerprint": "chrome" }
|
||
}
|
||
}'
|
||
|
||
# --- 6. ShadowSocks 2022 (Порт 8443) ---
|
||
OUT_SS='{
|
||
"tag": "proxy",
|
||
"protocol": "shadowsocks",
|
||
"settings": {
|
||
"servers": [{
|
||
"address": "$DOMAIN",
|
||
"port": 8443,
|
||
"method": "2022-blake3-aes-256-gcm",
|
||
"password": "${xray_sspasw_vrv}"
|
||
}]
|
||
}
|
||
}'
|
||
|
||
# 3. Сборка и генерация файла
|
||
# Используем subshell ( ) чтобы объединить выводы и передать в envsubst один раз
|
||
(
|
||
echo "["
|
||
print_config "$OUT_VISION" "🇪🇺 VLESS RAW XTLS-Vision"
|
||
echo ","
|
||
print_config "$OUT_XHTTP" "🇪🇺 VLESS XHTTP TLS EXTRA"
|
||
echo ","
|
||
print_config "$OUT_GRPC" "🇪🇺 VLESS gRPC TLS"
|
||
echo ","
|
||
print_config "$OUT_WS" "🇪🇺 VLESS WebSocket TLS"
|
||
echo ","
|
||
print_config "$OUT_TCP_HTTP" "🇪🇺 VLESS RAW TLS MUX"
|
||
echo ","
|
||
print_config "$OUT_SS" "🇪🇺 ShadowSocks2022"
|
||
echo "]"
|
||
) | envsubst > "$WEB_PATH/$path_subpage.json"
|
||
|
||
|
||
# Перезапуск Xray
|
||
echo "Перезапуск Xray..."
|
||
systemctl restart xray
|
||
echo -e "Готово!\n"
|
||
|
||
# Формирование ссылок
|
||
subPageLink="https://$DOMAIN/$path_subpage.json"
|
||
|
||
# Формирование ссылок
|
||
link01="vless://${xray_uuid_vrv}@$DOMAIN:443?security=tls&type=tcp&headerType=&path=&host=&flow=xtls-rprx-vision&sni=$DOMAIN&fp=chrome&spx=%2F#vlessTCPxtlsVision-autoXRAY"
|
||
|
||
link012="vless://${xray_uuid_vrv}@$DOMAIN:443?security=tls&type=tcp&headerType=http&path=%2F${path_xhttp}33&host=&sni=$DOMAIN&fp=chrome&spx=%2F#vlessTCPtls-autoXRAY"
|
||
|
||
link02="vless://${xray_uuid_vrv}@$DOMAIN:443?security=tls&type=xhttp&headerType=&path=%2F${path_xhttp}&host=&mode=auto&extra=%7B%22xmux%22%3A%7B%22cMaxReuseTimes%22%3A%221000-3000%22%2C%22maxConcurrency%22%3A%223-5%22%2C%22maxConnections%22%3A0%2C%22hKeepAlivePeriod%22%3A0%2C%22hMaxRequestTimes%22%3A%22400-700%22%2C%22hMaxReusableSecs%22%3A%221200-1800%22%7D%2C%22headers%22%3A%7B%7D%2C%22noGRPCHeader%22%3Afalse%2C%22xPaddingBytes%22%3A%22400-800%22%2C%22scMaxEachPostBytes%22%3A1500000%2C%22scMinPostsIntervalMs%22%3A20%2C%22scStreamUpServerSecs%22%3A%2260-240%22%7D&sni=$DOMAIN&fp=chrome&spx=%2F#vlessXHTTPtls-autoXRAY"
|
||
|
||
link03="vless://${xray_uuid_vrv}@$DOMAIN:443?security=tls&type=ws&headerType=&path=%2F${path_xhttp}22&host=&sni=$DOMAIN&fp=chrome&spx=%2F#vlessWStls-autoXRAY"
|
||
|
||
link04="vless://${xray_uuid_vrv}@$DOMAIN:443?security=tls&type=grpc&headerType=&serviceName=${path_xhttp}11&host=&sni=$DOMAIN&fp=chrome&spx=%2F#vlessGRPCtls-autoXRAY"
|
||
|
||
|
||
ENCODED_STRING=$(echo -n "2022-blake3-aes-256-gcm:${xray_sspasw_vrv}" | base64 -w 0)
|
||
linkSS="ss://${ENCODED_STRING}@${DOMAIN}:8443#Shadowsocks2022-autoXRAY"
|
||
|
||
configListLink="https://$DOMAIN/$path_subpage.html"
|
||
|
||
|
||
# Создаем html файл с конфигами
|
||
cat > "$WEB_PATH/$path_subpage.html" <<EOF
|
||
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||
<meta name="robots" content="noindex,nofollow,noarchive,nosnippet,noimageindex">
|
||
<title>AutoXRAY configs</title>
|
||
<style>
|
||
body { font-family: monospace; background: #121212; color: #e0e0e0; padding: 20px; max-width: 800px; margin: 0 auto; }
|
||
h3 { color: #82aaff; border-bottom: 1px solid #333; padding-bottom: 10px; margin-top: 30px; }
|
||
h2 { color: #c3e88d; border-top: 2px solid #333; padding-top: 20px; margin-top: 40px; }
|
||
|
||
/* Стили для строки с конфигом */
|
||
.config-row {
|
||
background: #1e1e1e;
|
||
border: 1px solid #333;
|
||
border-radius: 8px;
|
||
padding: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
/* Контейнер для текста ссылки */
|
||
.config-code {
|
||
flex: 1;
|
||
white-space: nowrap;
|
||
overflow-x: auto;
|
||
padding: 10px;
|
||
background: #121212;
|
||
border-radius: 4px;
|
||
color: #c3e88d;
|
||
font-size: 14px;
|
||
scrollbar-width: thin;
|
||
scrollbar-color: #333 #121212;
|
||
}
|
||
|
||
/* === ИЗМЕНЕНИЯ ЗДЕСЬ === */
|
||
/* Стиль для общего блока всех конфигов */
|
||
#cAll {
|
||
white-space: pre-wrap; /* Перенос строк */
|
||
word-break: break-all; /* Разрыв длинных ссылок */
|
||
max-height: 90px; /* Ограничение высоты (~3-4 строки) */
|
||
overflow-y: auto; /* Вертикальная прокрутка */
|
||
font-size: 12px; /* Чуть меньший шрифт для компактности */
|
||
}
|
||
|
||
/* Кнопка копирования */
|
||
.copy-btn {
|
||
background: #2c2c2c;
|
||
color: #e0e0e0;
|
||
border: 1px solid #555;
|
||
padding: 10px 15px;
|
||
border-radius: 6px;
|
||
cursor: pointer;
|
||
font-weight: bold;
|
||
transition: all 0.2s;
|
||
min-width: 100px;
|
||
height: 100%;
|
||
align-self: flex-start; /* Чтобы кнопка была вверху, если блок высокий */
|
||
}
|
||
.copy-btn:hover {
|
||
background: #c3e88d;
|
||
color: #121212;
|
||
border-color: #c3e88d;
|
||
}
|
||
.copy-btn:active {
|
||
transform: translateY(2px);
|
||
}
|
||
|
||
/* Старые стили */
|
||
.btn-group { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 25px; }
|
||
.btn { flex: 1; min-width: 250px; background-color: #2c2c2c; color: #c3e88d; border: 1px solid #c3e88d; padding: 15px; text-align: center; border-radius: 8px; text-decoration: none; font-weight: 700; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
|
||
.btn:hover { background-color: #c3e88d; color: #121212; cursor: pointer; box-shadow: 0 0 10px rgba(195,232,141,.3); }
|
||
.btn.download { border-color: #82aaff; color: #82aaff; }
|
||
.btn.download:hover { background-color: #82aaff; color: #121212; box-shadow: 0 0 10px rgba(130,170,255,.3); }
|
||
</style>
|
||
<script>
|
||
function copyText(elementId, btnElement) {
|
||
const text = document.getElementById(elementId).innerText;
|
||
navigator.clipboard.writeText(text).then(() => {
|
||
const originalText = btnElement.innerText;
|
||
btnElement.innerText = "Скопировано!";
|
||
btnElement.style.background = "#c3e88d";
|
||
btnElement.style.color = "#121212";
|
||
setTimeout(() => {
|
||
btnElement.innerText = originalText;
|
||
btnElement.style.background = "";
|
||
btnElement.style.color = "";
|
||
}, 2000);
|
||
}).catch(err => {
|
||
console.error('Ошибка:', err);
|
||
});
|
||
}
|
||
</script>
|
||
</head>
|
||
<body>
|
||
|
||
<h3>📂 Ссылка на подписку (готовый конфиг клиента с роутингом)</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="subLink">$subPageLink</div>
|
||
<button class="copy-btn" onclick="copyText('subLink', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>📱 Приложение HAPP (Windows/Android/iOS/MAC/Linux)</h3>
|
||
<p>Маршрутизацию нужно выключить, она тут встроенная. По умолчанию она выключена - включатся, если вы пользовались сторонними сервисами.</p>
|
||
<div class="btn-group">
|
||
<a href="happ://add/$subPageLink" class="btn">⚡ Автодобавление в HAPP</a>
|
||
<a href="https://www.happ.su/main/ru" target="_blank" class="btn download">⬇️ Скачать HAPP</a>
|
||
</div>
|
||
|
||
<h3>➡️ vless TCP xtls-Vision</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c1">$link01</div>
|
||
<button class="copy-btn" onclick="copyText('c1', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>➡️ vless TCP tls</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c2">$link012</div>
|
||
<button class="copy-btn" onclick="copyText('c2', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>➡️ vless XHTTP tls</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c3">$link02</div>
|
||
<button class="copy-btn" onclick="copyText('c3', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>➡️ vless WS tls</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c4">$link03</div>
|
||
<button class="copy-btn" onclick="copyText('c4', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>➡️ vless GRPC tls</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c5">$link04</div>
|
||
<button class="copy-btn" onclick="copyText('c5', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h3>➡️ Shadowsocks2022blake3 - новый и быстрый</h3>
|
||
<div class="config-row">
|
||
<div class="config-code" id="c6">$linkSS</div>
|
||
<button class="copy-btn" onclick="copyText('c6', this)">Копировать</button>
|
||
</div>
|
||
|
||
<h2>💠 Все конфиги вместе</h2>
|
||
<div class="config-row">
|
||
<!-- max-height: 90px ограничивает блок, а <br> делает перенос строк -->
|
||
<div class="config-code" id="cAll">$link01<br>$link012<br>$link02<br>$link03<br>$link04<br>$linkSS</div>
|
||
<button class="copy-btn" onclick="copyText('cAll', this)">Копировать</button>
|
||
</div>
|
||
|
||
</body>
|
||
</html>
|
||
EOF
|
||
|
||
|
||
|
||
echo -e "
|
||
Ваша json страничка подписки:
|
||
\033[32m$subPageLink\033[0m
|
||
|
||
Ссылка на сохраненные конфиги:
|
||
\033[32m$configListLink\033[0m
|
||
|
||
Скопируйте подписку в специализированное приложение:
|
||
- iOS: Happ или v2RayTun или v2rayN
|
||
- Android: Happ или v2RayTun или v2rayNG
|
||
- Windows: конфиги Happ или winLoadXRAY или v2rayN
|
||
для vless v2RayTun или Throne
|
||
|
||
Открыт локальный socks5 на порту 10808, 2080 и http на 10809.
|
||
|
||
Поддержать автора: https://github.com/xVRVx/autoXRAY
|
||
|
||
v444
|
||
"
|