feat: Добавлен веб-сервер на Python для управления VPN-прокси, Dockerfile для sing-box и обновлен README.

This commit is contained in:
2025-12-27 21:00:13 +03:00
parent b65b48d82b
commit 560c4b8661
3 changed files with 52 additions and 27 deletions

View File

@@ -123,7 +123,7 @@ docker compose up -d
| Порт | Для чего | URL |
| ------ | ------------------------------------------------- | ----------------------- |
| `3456` | **Веб-интерфейс** — управление через браузер | http://localhost:3456 |
| `8082` | **Прокси** — сюда подключаются браузер/приложения | `http://127.0.0.1:8082` |
| `2412` | **Прокси** — сюда подключаются браузер/приложения | `http://127.0.0.1:8082` |
| `9090` | Внутренний порт управления (обычно не нужен) | — |
---

View File

@@ -1,5 +1,5 @@
FROM alpine:3.20
ARG SINGBOX_VER=1.8.10
ARG SINGBOX_VER=1.12.13
# Устанавливаем зависимости, включая dos2unix для исправления скриптов
RUN apk add --no-cache curl ca-certificates tar jq bash coreutils netcat-openbsd python3 dos2unix && update-ca-certificates

View File

@@ -139,18 +139,27 @@ def parse_vless_url(url: str) -> dict:
def generate_vless_config(vless_params: dict) -> dict:
"""Generate sing-box configuration from VLESS parameters"""
config = {
"dns": {
"independent_cache": True
},
"log": {
"level": "info",
"level": "debug",
"disabled": True,
"timestamp": True
},
"route": {
"final": vless_params['tag'],
"auto_detect_interface": True
},
"inbounds": [
{
"type": "mixed",
"tag": "mixed-in",
"type": "mixed",
"sniff": True,
"users": [],
"listen": "0.0.0.0",
"listen_port": 8082,
"sniff": True,
"sniff_override_destination": True
"set_system_proxy": False
}
],
"outbounds": [
@@ -159,36 +168,27 @@ def generate_vless_config(vless_params: dict) -> dict:
"tag": vless_params['tag'],
"server": vless_params['server'],
"server_port": vless_params['server_port'],
"uuid": vless_params['uuid'],
"flow": vless_params['flow'],
"tls": {
"enabled": True,
"server_name": vless_params['server_name'],
"utls": {
"enabled": True,
"fingerprint": vless_params['fingerprint']
},
"reality": {
"enabled": True,
"public_key": vless_params['public_key'],
"short_id": vless_params['short_id']
},
"utls": {
"enabled": True,
"fingerprint": vless_params['fingerprint']
}
},
"packet_encoding": "xudp"
"uuid": vless_params['uuid']
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
"tag": "direct",
"type": "direct"
}
],
"route": {
"final": vless_params['tag'],
"auto_detect_interface": True
}
]
}
return config
@@ -447,10 +447,35 @@ class ProxyControlHandler(http.server.BaseHTTPRequestHandler):
# Add selected server as main outbound
new_outbounds.insert(0, selected_outbound)
# Update route rules to use selected server
routes = config.get("route", {})
final_outbound = selected_tag
routes["final"] = final_outbound
# Update route - remove incompatible fields and set only final
# Some subscription configs have route.rules with "action" field which is not supported
routes = {
"final": selected_tag,
"auto_detect_interface": True
}
# Simplify DNS configuration to match client.json format
config["dns"] = {
"independent_cache": True
}
# Remove platform-specific and experimental fields from root config
config.pop("platform", None)
config.pop("experimental", None)
# Replace TUN inbounds with mixed proxy (TUN requires privileges in Docker)
# Use mixed proxy on 127.0.0.1:2412 instead
config["inbounds"] = [
{
"tag": "mixed-in",
"type": "mixed",
"sniff": True,
"users": [],
"listen": "0.0.0.0",
"listen_port": 8082,
"set_system_proxy": False
}
]
config["outbounds"] = new_outbounds
config["route"] = routes