From 702123e39cc421ceb0421838900cba7580e0e5f8 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 17 Apr 2025 00:58:13 +0400 Subject: [PATCH] vless: ip limit only notifies --- app/bot.php | 17 ++++++++++------- makefile | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/bot.php b/app/bot.php index 65d579a..0125138 100644 --- a/app/bot.php +++ b/app/bot.php @@ -5998,7 +5998,6 @@ DNS-over-HTTPS with IP: public function frequencyAnalyze($line, $pac) { - preg_match('~(?.+)\sfrom\s(?\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?.+))~', $line, $m); if (!empty($this->pool)) { foreach ($this->pool as $i => $j) { if (!empty($j['ips'])) { @@ -6010,6 +6009,9 @@ DNS-over-HTTPS with IP: } } } + if (empty(preg_match('~(?.+)\sfrom\s(?\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?.+))~', $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) { @@ -6021,18 +6023,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; } } diff --git a/makefile b/makefile index 4bc6707..13efc59 100644 --- a/makefile +++ b/makefile @@ -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