feat: Добавлен веб-сервер на Python для управления VPN-прокси, Dockerfile для sing-box и обновлен README.
This commit is contained in:
@@ -123,7 +123,7 @@ docker compose up -d
|
|||||||
| Порт | Для чего | URL |
|
| Порт | Для чего | URL |
|
||||||
| ------ | ------------------------------------------------- | ----------------------- |
|
| ------ | ------------------------------------------------- | ----------------------- |
|
||||||
| `3456` | **Веб-интерфейс** — управление через браузер | http://localhost:3456 |
|
| `3456` | **Веб-интерфейс** — управление через браузер | http://localhost:3456 |
|
||||||
| `8082` | **Прокси** — сюда подключаются браузер/приложения | `http://127.0.0.1:8082` |
|
| `2412` | **Прокси** — сюда подключаются браузер/приложения | `http://127.0.0.1:8082` |
|
||||||
| `9090` | Внутренний порт управления (обычно не нужен) | — |
|
| `9090` | Внутренний порт управления (обычно не нужен) | — |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
ARG SINGBOX_VER=1.8.10
|
ARG SINGBOX_VER=1.12.13
|
||||||
|
|
||||||
# Устанавливаем зависимости, включая dos2unix для исправления скриптов
|
# Устанавливаем зависимости, включая dos2unix для исправления скриптов
|
||||||
RUN apk add --no-cache curl ca-certificates tar jq bash coreutils netcat-openbsd python3 dos2unix && update-ca-certificates
|
RUN apk add --no-cache curl ca-certificates tar jq bash coreutils netcat-openbsd python3 dos2unix && update-ca-certificates
|
||||||
|
|||||||
@@ -139,18 +139,27 @@ def parse_vless_url(url: str) -> dict:
|
|||||||
def generate_vless_config(vless_params: dict) -> dict:
|
def generate_vless_config(vless_params: dict) -> dict:
|
||||||
"""Generate sing-box configuration from VLESS parameters"""
|
"""Generate sing-box configuration from VLESS parameters"""
|
||||||
config = {
|
config = {
|
||||||
|
"dns": {
|
||||||
|
"independent_cache": True
|
||||||
|
},
|
||||||
"log": {
|
"log": {
|
||||||
"level": "info",
|
"level": "debug",
|
||||||
|
"disabled": True,
|
||||||
"timestamp": True
|
"timestamp": True
|
||||||
},
|
},
|
||||||
|
"route": {
|
||||||
|
"final": vless_params['tag'],
|
||||||
|
"auto_detect_interface": True
|
||||||
|
},
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"type": "mixed",
|
|
||||||
"tag": "mixed-in",
|
"tag": "mixed-in",
|
||||||
|
"type": "mixed",
|
||||||
|
"sniff": True,
|
||||||
|
"users": [],
|
||||||
"listen": "0.0.0.0",
|
"listen": "0.0.0.0",
|
||||||
"listen_port": 8082,
|
"listen_port": 8082,
|
||||||
"sniff": True,
|
"set_system_proxy": False
|
||||||
"sniff_override_destination": True
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outbounds": [
|
"outbounds": [
|
||||||
@@ -159,36 +168,27 @@ def generate_vless_config(vless_params: dict) -> dict:
|
|||||||
"tag": vless_params['tag'],
|
"tag": vless_params['tag'],
|
||||||
"server": vless_params['server'],
|
"server": vless_params['server'],
|
||||||
"server_port": vless_params['server_port'],
|
"server_port": vless_params['server_port'],
|
||||||
"uuid": vless_params['uuid'],
|
|
||||||
"flow": vless_params['flow'],
|
"flow": vless_params['flow'],
|
||||||
"tls": {
|
"tls": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"server_name": vless_params['server_name'],
|
"server_name": vless_params['server_name'],
|
||||||
"utls": {
|
|
||||||
"enabled": True,
|
|
||||||
"fingerprint": vless_params['fingerprint']
|
|
||||||
},
|
|
||||||
"reality": {
|
"reality": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"public_key": vless_params['public_key'],
|
"public_key": vless_params['public_key'],
|
||||||
"short_id": vless_params['short_id']
|
"short_id": vless_params['short_id']
|
||||||
|
},
|
||||||
|
"utls": {
|
||||||
|
"enabled": True,
|
||||||
|
"fingerprint": vless_params['fingerprint']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packet_encoding": "xudp"
|
"uuid": vless_params['uuid']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "direct",
|
"tag": "direct",
|
||||||
"tag": "direct"
|
"type": "direct"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "block",
|
|
||||||
"tag": "block"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"route": {
|
|
||||||
"final": vless_params['tag'],
|
|
||||||
"auto_detect_interface": True
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
@@ -447,10 +447,35 @@ class ProxyControlHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
# Add selected server as main outbound
|
# Add selected server as main outbound
|
||||||
new_outbounds.insert(0, selected_outbound)
|
new_outbounds.insert(0, selected_outbound)
|
||||||
|
|
||||||
# Update route rules to use selected server
|
# Update route - remove incompatible fields and set only final
|
||||||
routes = config.get("route", {})
|
# Some subscription configs have route.rules with "action" field which is not supported
|
||||||
final_outbound = selected_tag
|
routes = {
|
||||||
routes["final"] = final_outbound
|
"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["outbounds"] = new_outbounds
|
||||||
config["route"] = routes
|
config["route"] = routes
|
||||||
|
|||||||
Reference in New Issue
Block a user