Compare commits

..

12 Commits

Author SHA1 Message Date
mercury d7ed7042ec update version 2025-05-17 14:54:58 +04:00
mercury 4496a30552 add status process container 2025-05-17 14:49:32 +04:00
mercury ca1a596f85 fix crash vless when enable timer user 2025-05-17 14:24:22 +04:00
mercury b3edf1bdcc Merge branch 'dev' of github.com:mercurykd/vpnbot into dev 2025-05-17 13:55:28 +04:00
mercury c6306aa918 vless: check already exists user 2025-05-17 13:52:45 +04:00
Konstantin d5bbc9a564 Merge pull request #39 from legiz-ru/dev
add no overwrite key for Clash Mi
2025-05-10 12:22:57 +04:00
legiz-ru d2aab8ee4b add no overwrite key for Clash Mi 2025-05-09 22:18:30 +03:00
mercury 304217d36e Периодическое падение upstream при запуске сервисов 2025-04-26 23:37:37 +04:00
mercury 2622397542 mihomo: udp true 2025-04-18 23:40:33 +04:00
mercury 702123e39c vless: ip limit only notifies 2025-04-17 00:58:13 +04:00
mercury 01ef7707c4 fix first start 2025-04-14 11:36:26 +04:00
mercury 064d39d80b Excess image php 2025-04-09 18:12:18 +04:00
5 changed files with 72 additions and 36 deletions
+47 -32
View File
@@ -40,7 +40,7 @@ class Bot
$this->reg = '~' . implode('|', [
'GET / HTTP',
'GET /favicon.ico HTTP',
preg_quote($this->getHashBot())
preg_quote($this->getHashBot(1))
]) . '~';
}
@@ -1188,8 +1188,7 @@ class Bot
$this->ssh('ssserver -v -d -c /config.json', 'ss');
$this->ssh('sslocal -v -d -c /config.json', 'proxy');
$this->sd($c, 1);
if (!empty($nomenu)) {
if (empty($nomenu)) {
$this->menu('ss');
}
}
@@ -4324,47 +4323,47 @@ DNS-over-HTTPS with IP:
'data' => [
[
[
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['amnezia'] ? 'awg' : 'wg', 'wg') ? 'on' : 'off'),
'callback_data' => "/changeWG 0",
],
[
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['wg1_amnezia'] ? 'awg' : 'wg', 'wg1') ? 'on' : 'off'),
'callback_data' => "/changeWG 1",
],
],
[
[
'text' => $this->i18n('xray'),
'text' => $this->i18n('xray') . ' ' . $this->i18n($this->ssh('pgrep xray', 'xr') ? 'on' : 'off'),
'callback_data' => "/xray",
],
[
'text' => $this->i18n('naive'),
'text' => $this->i18n('naive') . ' ' . $this->i18n($this->ssh('pgrep caddy', 'np') ? 'on' : 'off'),
'callback_data' => "/menu naive",
],
],
[
[
'text' => $this->i18n('ocserv'),
'text' => $this->i18n('ocserv') . ' ' . $this->i18n($this->ssh('pgrep ocserv', 'oc') ? 'on' : 'off'),
'callback_data' => "/menu oc",
],
[
'text' => $this->i18n('mtproto'),
'text' => $this->i18n('mtproto') . ' ' . $this->i18n($this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off'),
'callback_data' => "/mtproto",
],
],
[
[
'text' => $this->i18n('ad_title'),
'text' => $this->i18n('ad_title') . ' ' . $this->i18n(exec("JSON=1 timeout 2 dnslookup google.com ad") ? 'on' : 'off'),
'callback_data' => "/menu adguard",
],
[
'text' => $this->i18n('warp') . ': ' . $this->warpStatus(),
'text' => $this->i18n('warp') . ' ' . $this->i18n($this->warpStatus()),
'callback_data' => "/warp",
],
],
[
[
'text' => $this->i18n('sh_title'),
'text' => $this->i18n('sh_title') . ' ' . $this->i18n($this->ssh('pgrep ssserver', 'ss') ? 'on' : 'off'),
'callback_data' => "/menu ss",
],
[
@@ -5346,8 +5345,16 @@ DNS-over-HTTPS with IP:
$p = $this->getPacConf();
$users = array_map(fn ($e) => trim($e), explode(',', $users));
$users = array_map(fn ($e) => explode(':', $e), $users);
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
$uuids[] = $v['id'];
$emails[] = $v['email'];
}
foreach ($users as $user) {
$uuid = $user[1] ?: trim($this->ssh('xray uuid', 'xr'));
if (in_array($uuid, $uuids ?: []) || in_array($user[0], $emails ?: [])) {
$this->send($this->input['chat'], "user {$user[0]} already exists");
return $this->xray();
}
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] != 'Reality' ? [
'id' => $uuid,
'email' => $user[0],
@@ -5377,20 +5384,22 @@ DNS-over-HTTPS with IP:
$this->send($this->input['chat'], 'wrong format');
return;
}
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
$this->switchXr($i, 1);
$c = $this->getXray();
}
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
}
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$this->userXr($i);
$this->restartXray($c, 1);
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
$this->switchXr($i, 0, 1);
} else {
$this->userXr($i);
}
}
public function switchXr($i, $nm = 0)
public function switchXr($i, $nm = 0, $time = false)
{
$c = $this->getXray();
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
if (empty($time)) {
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
}
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
@@ -5999,7 +6008,6 @@ DNS-over-HTTPS with IP:
public function frequencyAnalyze($line, $pac)
{
preg_match('~(?<date>.+)\sfrom\s(?<ip>\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?<email>.+))~', $line, $m);
if (!empty($this->pool)) {
foreach ($this->pool as $i => $j) {
if (!empty($j['ips'])) {
@@ -6011,6 +6019,9 @@ DNS-over-HTTPS with IP:
}
}
}
if (empty(preg_match('~(?<date>.+)\sfrom\s(?<ip>\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?<email>.+))~', $line, $m))) {
return;
}
if (!empty($m['ip']) && !empty($m['email'])) {
$ip = ip2long($m['ip']);
if (!empty($this->pool[$m['email']]['ip']) && $this->pool[$m['email']]['ip'] != $ip) {
@@ -6022,18 +6033,19 @@ DNS-over-HTTPS with IP:
if (empty($v['off']) && $v['email'] == $m['email']) {
require __DIR__ . '/config.php';
foreach ($c['admin'] as $admin) {
$this->send($admin, "vless: {$m['email']} is turned off (limit by one IP)");
$this->send($admin, "vless: {$m['email']} limit ip " . count($this->pool[$m['email']]['ips']) . ' > ' . ($pac['ip_count'] ?: 1), button: [[
[
'text' => $this->i18n($c['off'] ? 'off' : 'on'),
'callback_data' => "/switchXr $k",
],
]]);
}
unset($this->pool[$m['email']]);
$this->switchXr($k, 1);
$flag = 1;
break;
}
}
}
if (empty($flag)) {
$this->pool[$m['email']]['ip'] = $ip;
}
$this->pool[$m['email']]['ip'] = $ip;
}
}
@@ -6358,7 +6370,7 @@ DNS-over-HTTPS with IP:
header("Location: hiddify://install-config/?url=$si");
exit;
case 'c':
header("Location: clash://install-config/?url=$cl&name=$email");
header("Location: clash://install-config/?url=$cl&overwrite=no&name=$email");
exit;
case 'w':
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
@@ -6805,14 +6817,16 @@ DNS-over-HTTPS with IP:
$this->ssh("nginx -s reload 2>&1", 'up');
}
public function getHashBot()
public function getHashBot($notset = false)
{
$p = $this->getPacConf();
if (!empty($p['hashbot'])) {
return $p['hashbot'];
}
$p['hashbot'] = substr(hash('sha256', $this->key), 0, 8);
$this->setPacConf($p);
if (empty($notset)) {
$this->setPacConf($p);
}
return $p['hashbot'];
}
@@ -8083,8 +8097,9 @@ DNS-over-HTTPS with IP:
}
echo "$ip\n";
var_dump($r = $this->request('setWebhook', [
'url' => "https://$ip/tlgrm?k={$this->key}",
'certificate' => curl_file_create('/certs/self_public'),
'url' => "https://$ip/tlgrm?k={$this->key}",
'certificate' => curl_file_create('/certs/self_public'),
'allowed_updates' => json_encode(['*']),
]));
if (!empty($r['result']) && $r['result'] == true) {
file_put_contents('/start', 1);
+1
View File
@@ -72,6 +72,7 @@
"uuid": "~uid~",
"network": "tcp",
"flow": "xtls-rprx-vision",
"udp": true,
"tls": true,
"reality-opts": {
"public-key": "~public_key~",
+12 -4
View File
@@ -42,10 +42,18 @@ services:
depends_on:
php:
condition: service_healthy
ng:
condition: service_started
ad:
condition: service_started
ss:
condition: service_started
xr:
condition: service_started
oc:
condition: service_started
np:
condition: service_started
env_file:
- path: ./.env
required: true # default
@@ -79,9 +87,6 @@ services:
- 80:80
hostname: nginx
container_name: nginx-${VER}
depends_on:
up:
condition: service_started
env_file:
- path: ./.env
required: true # default
@@ -95,6 +100,9 @@ services:
xray:
ipv4_address: 10.10.1.2
logging: *default-logging
depends_on:
php:
condition: service_healthy
php:
image: mercurykd/vpnbot-php:1.7
build:
@@ -147,7 +155,7 @@ services:
timeout: 5s
retries: 5
service:
image: mercurykd/vpnbot-php:1.6
image: mercurykd/vpnbot-php:1.7
build:
dockerfile: dockerfile/php.dockerfile
args:
+2
View File
@@ -41,6 +41,8 @@ xr: # консоль сервиса
docker compose exec xr /bin/sh
oc: # консоль сервиса
docker compose exec oc /bin/sh
service: # консоль сервиса
docker compose exec service /bin/sh
clean:
docker image prune
docker builder prune
+10
View File
@@ -1,3 +1,13 @@
17.05.2025 v2.19
- фикс падения vless при одинаковом имени пользователей
- фикс падения vless при установке таймера для выключенного пользователя
- подсветка в меню работы процесса контейнера
- overwrite=no для импорта клеш подписки (legiz)
18.04.2025 v2.18
- фикс отсутствия ssl при первом старте
- iplimit уведомляет без отключения пользователя
- включение udp в mihomo-шаблоне
- удаление лишнего образа пхп
07.04.2025 v2.17
- фикс циклической перезагрузки панели adguardHome
07.04.2025 v2.16