Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dff9e039f | |||
| e2441eb9fd | |||
| 269d0e9956 | |||
| 8ba85164aa | |||
| e7cc7b66e2 |
+4
-1
@@ -27,4 +27,7 @@ backup.json
|
||||
app/webapp/override/
|
||||
.rest
|
||||
|
||||
subscription.php
|
||||
subscription.php
|
||||
location.conf
|
||||
override.conf
|
||||
i18n.override.php
|
||||
+25
-24
@@ -5309,35 +5309,21 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function getMirror()
|
||||
{
|
||||
unlink('/config/mirror.tar.gz');
|
||||
unlink('/config/mirror.tar');
|
||||
$s = file_get_contents('/mirror/start_socat.sh');
|
||||
$t = preg_replace([
|
||||
'~{ip}~',
|
||||
'~{tg}~',
|
||||
'~{ss}~',
|
||||
'~{wg}~',
|
||||
$t = str_replace([
|
||||
'~ip~',
|
||||
'~tg~',
|
||||
'~ss~',
|
||||
'~wg1~',
|
||||
'~wg2~',
|
||||
], [
|
||||
getenv('IP'),
|
||||
getenv('TGPORT'),
|
||||
getenv('SSPORT'),
|
||||
getenv('WGPORT'),
|
||||
getenv('WG1PORT'),
|
||||
], $s);
|
||||
file_put_contents('/mirror/start_socat.sh', $t);
|
||||
$a = new PharData('/config/mirror.tar');
|
||||
$a->buildFromDirectory('/mirror');
|
||||
$a->compress(Phar::GZ);
|
||||
if (!empty($this->input)) {
|
||||
$this->sendFile($this->input['from'], curl_file_create('/config/mirror.tar.gz'));
|
||||
} else {
|
||||
header('Content-Disposition: attachment; filename=mirror.tar.gz');
|
||||
header('Content-Type: application/tar+gzip');
|
||||
echo file_get_contents('/config/mirror.tar.gz');
|
||||
exit;
|
||||
}
|
||||
unlink('/config/mirror.tar.gz');
|
||||
unlink('/config/mirror.tar');
|
||||
file_put_contents('/mirror/start_socat.sh', $s);
|
||||
$this->sendFile($this->input['from'], new CURLStringFile($t, 'socat.sh', 'application/x-sh'));
|
||||
}
|
||||
|
||||
public function ocMenu()
|
||||
@@ -6110,7 +6096,7 @@ DNS-over-HTTPS with IP:
|
||||
if (!empty($this->ssh('pgrep warp-svc', 'wp'))) {
|
||||
$st = $this->ssh('curl -m 1 -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp');
|
||||
preg_match('~warp=(\w+)~', $st, $m);
|
||||
return $m[1];
|
||||
return trim($m[1]) ?: 'off';
|
||||
}
|
||||
return 'off';
|
||||
}
|
||||
@@ -6484,10 +6470,19 @@ DNS-over-HTTPS with IP:
|
||||
]));
|
||||
$vless = $this->linkXray($k);
|
||||
$windows = "$scheme://{$domain}/pac$hash?t=si&r=w&s=$uid";
|
||||
$_GET['s'] = $uid;
|
||||
foreach ([
|
||||
'xray' => 's',
|
||||
'singbox' => 'si',
|
||||
'clash' => 'cl'
|
||||
] as $k => $v) {
|
||||
$_GET['t'] = $v;
|
||||
$configs[$k] = $this->subscription(1);
|
||||
}
|
||||
require __DIR__ . '/subscription.php';
|
||||
}
|
||||
|
||||
public function subscription()
|
||||
public function subscription($return = false)
|
||||
{
|
||||
switch ($_GET['t']) {
|
||||
case 's':
|
||||
@@ -6741,6 +6736,12 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!empty($return)) {
|
||||
if ($_GET['t'] == 'cl') {
|
||||
return yaml_emit($c);
|
||||
}
|
||||
return json_encode($c);
|
||||
}
|
||||
|
||||
if ($_GET['t'] == 'cl') {
|
||||
header('Content-type: text/yaml');
|
||||
|
||||
@@ -378,3 +378,7 @@ $i = [
|
||||
'ru' => 'перезагрузка',
|
||||
],
|
||||
];
|
||||
|
||||
if (file_exists(__DIR__ . '/i18n.override.php')) {
|
||||
include __DIR__ . '/i18n.override.php';
|
||||
}
|
||||
|
||||
+4
-1
@@ -11,7 +11,7 @@ events {
|
||||
http {
|
||||
server_names_hash_bucket_size 64;
|
||||
server_tokens off;
|
||||
include include.conf;
|
||||
include override.conf;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
@@ -122,6 +122,7 @@ http {
|
||||
proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||
proxy_pass https://ad/dns-query;
|
||||
}
|
||||
include location.conf;
|
||||
}
|
||||
|
||||
#~
|
||||
@@ -210,6 +211,8 @@ http {
|
||||
# proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||
# proxy_pass https://ad/dns-query;
|
||||
# }
|
||||
|
||||
# include location.conf;
|
||||
# }
|
||||
#-domain
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ events {
|
||||
http {
|
||||
server_names_hash_bucket_size 64;
|
||||
server_tokens off;
|
||||
include include.conf;
|
||||
include override.conf;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
@@ -122,6 +122,7 @@ http {
|
||||
proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||
proxy_pass https://ad/dns-query;
|
||||
}
|
||||
include location.conf;
|
||||
}
|
||||
|
||||
#~
|
||||
@@ -210,6 +211,8 @@ http {
|
||||
# proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||
# proxy_pass https://ad/dns-query;
|
||||
# }
|
||||
|
||||
# include location.conf;
|
||||
# }
|
||||
#-domain
|
||||
}
|
||||
|
||||
+2
-1
@@ -75,7 +75,8 @@ services:
|
||||
volumes:
|
||||
- ./config/.profile:/root/.ashrc:ro
|
||||
- ./config/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./config/include.conf:/etc/nginx/include.conf
|
||||
- ./config/override.conf:/etc/nginx/override.conf
|
||||
- ./config/location.conf:/etc/nginx/location.conf
|
||||
- ./config/nginx_default.conf:/nginx_default.conf
|
||||
- ./scripts/start_ng.sh:/start_ng.sh
|
||||
- ./certs/:/certs/
|
||||
|
||||
@@ -3,7 +3,7 @@ b:
|
||||
u: # запуск контейнеров
|
||||
$(eval IP := $(shell hostname -I | awk '{print $$1}'))
|
||||
bash ./update/update.sh &
|
||||
touch ./override.env ./docker-compose.override.yml
|
||||
touch ./override.env ./docker-compose.override.yml ./config/location.conf ./config/override.conf
|
||||
IP=$(IP) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||
d: # остановка контейнеров
|
||||
-kill -9 $(shell cat ./update/update_pid) > /dev/null
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
socat:
|
||||
build:
|
||||
dockerfile: ./dockerfile
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- 853:853
|
||||
- ${TGPORT}:${TGPORT}
|
||||
- ${SSPORT}:${SSPORT}
|
||||
- ${SSPORT}:${SSPORT}/udp
|
||||
- ${WGPORT}:${WGPORT}/udp
|
||||
volumes:
|
||||
- ./start_socat.sh:/start_socat.sh
|
||||
command: /bin/sh /start_socat.sh
|
||||
stop_grace_period: 1s
|
||||
@@ -1,2 +0,0 @@
|
||||
FROM alpine:3.18
|
||||
RUN apk add socat htop net-tools
|
||||
@@ -1,11 +0,0 @@
|
||||
b:
|
||||
docker compose build --no-cache
|
||||
u:
|
||||
docker compose up -d --build
|
||||
d:
|
||||
docker compose down
|
||||
ps:
|
||||
docker compose ps
|
||||
e:
|
||||
docker compose exec socat sh
|
||||
r: d u
|
||||
+53
-8
@@ -1,8 +1,53 @@
|
||||
socat TCP-LISTEN:80,fork TCP:{ip}:80 &
|
||||
socat TCP-LISTEN:443,fork TCP:{ip}:443 &
|
||||
socat TCP-LISTEN:853,fork TCP:{ip}:853 &
|
||||
socat TCP-LISTEN:{tg},fork TCP:{ip}:{tg} &
|
||||
socat TCP-LISTEN:{ss},fork TCP:{ip}:{ss} &
|
||||
socat UDP-LISTEN:{ss},fork UDP:{ip}:{ss} &
|
||||
socat UDP-LISTEN:{wg},fork UDP:{ip}:{wg} &
|
||||
tail -f /dev/null
|
||||
#!/bin/bash
|
||||
|
||||
# Параметры (можно менять)
|
||||
PORTS=(80 443 853 ~tg~ ~ss~ ~wg1~ ~wg2~) # Прослушиваемые порты
|
||||
TARGET="~ip~" # Куда перенаправляем трафик
|
||||
TCP_CMD="socat TCP-LISTEN:{PORT},fork,reuseaddr TCP:$TARGET:{PORT}"
|
||||
UDP_CMD="socat UDP-LISTEN:{PORT},fork,reuseaddr UDP:$TARGET:{PORT}"
|
||||
|
||||
# Проверяем, установлен ли socat
|
||||
if ! command -v socat &> /dev/null; then
|
||||
echo "socat не установлен. Устанавливаем..."
|
||||
if [[ -f /etc/debian_version ]]; then
|
||||
sudo apt update && sudo apt install -y socat
|
||||
elif [[ -f /etc/redhat-release ]]; then
|
||||
sudo yum install -y socat
|
||||
else
|
||||
echo "Ошибка: Неизвестный дистрибутив. Установите socat вручную."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Проверяем, заняты ли порты (TCP и UDP)
|
||||
for PORT in "${PORTS[@]}"; do
|
||||
# Проверка TCP
|
||||
if ss -tulnp | grep -q ":$PORT "; then
|
||||
PROCESS=$(ss -tulnp | grep ":$PORT " | awk '{print $7}')
|
||||
echo "Ошибка: Порт $PORT (TCP) занят процессом: $PROCESS"
|
||||
exit 1
|
||||
fi
|
||||
# Проверка UDP
|
||||
if ss -ulnp | grep -q ":$PORT "; then
|
||||
PROCESS=$(ss -ulnp | grep ":$PORT " | awk '{print $6}')
|
||||
echo "Ошибка: Порт $PORT (UDP) занят процессом: $PROCESS"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Запускаем socat для каждого порта (TCP и UDP)
|
||||
for PORT in "${PORTS[@]}"; do
|
||||
# TCP
|
||||
CMD_TCP=$(echo "$TCP_CMD" | sed "s/{PORT}/$PORT/g")
|
||||
echo "Запуск (TCP): $CMD_TCP"
|
||||
eval "$CMD_TCP &" # Запускаем в фоне
|
||||
|
||||
# UDP
|
||||
CMD_UDP=$(echo "$UDP_CMD" | sed "s/{PORT}/$PORT/g")
|
||||
echo "Запуск (UDP): $CMD_UDP"
|
||||
eval "$CMD_UDP &" # Запускаем в фоне
|
||||
done
|
||||
|
||||
echo "socat запущен для портов: ${PORTS[*]} (TCP и UDP)"
|
||||
echo "Трафик перенаправляется на: $TARGET"
|
||||
echo "Для остановки выполните: pkill socat"
|
||||
@@ -1,3 +1,12 @@
|
||||
19.07.2025 v2.25
|
||||
- перед запуском обязательно запустить:
|
||||
<pre>touch ./override.env ./docker-compose.override.yml ./config/location.conf ./config/override.conf</pre>
|
||||
- для nginx вместо include.conf теперь override.conf, не затирается
|
||||
- location.conf (by legiz), не затирается
|
||||
- app/i18n.override.php для собственных названий кнопок, не затирается
|
||||
16.07.2025 v2.24
|
||||
- фикс зависания бота из-за пустого статуса warp
|
||||
- скрипт socat.sh для мостов /mirror
|
||||
04.07.2025 v2.23
|
||||
- фикс двойного /id
|
||||
- фикс отображения статы vless на мобилке
|
||||
|
||||
Reference in New Issue
Block a user