Compare commits

...

10 Commits

Author SHA1 Message Date
mercury 6074d40643 update version 2025-02-22 18:52:17 +04:00
mercury 4b1df94325 Revert "add clash mode selector for sing-box clients"
This reverts commit fb22744fa7.
2025-02-22 18:51:49 +04:00
mercury 232c75d5bf Merge branch 'dev' of github.com:mercurykd/vpnbot into dev 2025-02-22 18:50:32 +04:00
mercury 5e860a4896 fix addruleset for block outbound 2025-02-22 18:47:36 +04:00
Konstantin 5b05486b98 Merge pull request #35 from legiz-ru/dev
add clash mode selector for sing-box clients
2025-02-13 10:13:38 +04:00
legiz-ru fb22744fa7 add clash mode selector for sing-box clients 2025-02-13 08:11:20 +03:00
mercury af812b7c93 vless: stats collect improve 2025-02-12 13:29:08 +04:00
mercury 3302ca8871 vless stats: fix delete user 2025-02-12 12:50:39 +04:00
mercury 2c5eff03d5 vless stats: fix reset user stats 2025-02-12 00:25:23 +04:00
mercury a8a203041f vless stats: fix reset user stats 2025-02-11 22:48:47 +04:00
2 changed files with 30 additions and 17 deletions
+27 -17
View File
@@ -755,11 +755,11 @@ class Bot
'download' => 0, 'download' => 0,
'upload' => 0, 'upload' => 0,
]; ];
foreach ($p['clients'] as $k => $v) { foreach ($p['users'] as $k => $v) {
$p['clients'][$k]['global']['download'] += $v['session']['download']; $p['users'][$k]['global']['download'] += $v['session']['download'];
$p['clients'][$k]['session']['download'] = 0; $p['users'][$k]['session']['download'] = 0;
$p['clients'][$k]['global']['upload'] += $v['session']['upload']; $p['users'][$k]['global']['upload'] += $v['session']['upload'];
$p['clients'][$k]['session']['upload'] = 0; $p['users'][$k]['session']['upload'] = 0;
} }
$this->setXrayStats($p); $this->setXrayStats($p);
} }
@@ -993,7 +993,7 @@ class Bot
{ {
$r = $this->send( $r = $this->send(
$this->input['chat'], $this->input['chat'],
"@{$this->input['username']} enter pass", "@{$this->input['username']} enter password",
$this->input['message_id'], $this->input['message_id'],
reply: 'enter password', reply: 'enter password',
); );
@@ -1011,7 +1011,7 @@ class Bot
$this->input['chat'], $this->input['chat'],
"@{$this->input['username']} enter name", "@{$this->input['username']} enter name",
$this->input['message_id'], $this->input['message_id'],
reply: 'enter password', reply: 'enter name',
); );
$_SESSION['reply'][$r['result']['message_id']] = [ $_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'], 'start_message' => $this->input['message_id'],
@@ -1357,14 +1357,22 @@ class Bot
'upload' => $tu, 'upload' => $tu,
]; ];
if (!empty($users = $x['inbounds'][0]['settings']['clients'])) { if (!empty($users = $x['inbounds'][0]['settings']['clients'])) {
$tmp = [];
foreach ($users as $k => $v) { foreach ($users as $k => $v) {
$d = json_decode($this->ssh('xray api stats --server=127.0.0.1:8080 -name "user>>>' . $v['email'] . '>>>traffic>>>downlink" 2>&1', 'xr'), true)['stat']['value'] ?: 0; $d = json_decode($this->ssh('xray api stats --server=127.0.0.1:8080 -name "user>>>' . $v['email'] . '>>>traffic>>>downlink" 2>&1', 'xr'), true)['stat']['value'] ?: 0;
$u = json_decode($this->ssh('xray api stats --server=127.0.0.1:8080 -name "user>>>' . $v['email'] . '>>>traffic>>>uplink" 2>&1', 'xr'), true)['stat']['value'] ?: 0; $u = json_decode($this->ssh('xray api stats --server=127.0.0.1:8080 -name "user>>>' . $v['email'] . '>>>traffic>>>uplink" 2>&1', 'xr'), true)['stat']['value'] ?: 0;
$p['users'][$k]['session'] = [ $tmp[$k] = [
'download' => $d, 'session' => [
'upload' => $u, 'download' => $d,
'upload' => $u,
],
'global' => [
'download' => $p['users'][$k]['global']['download'],
'upload' => $p['users'][$k]['global']['upload'],
]
]; ];
} }
$p['users'] = $tmp;
} }
$this->setXrayStats($p); $this->setXrayStats($p);
} catch (\Throwable $th) { } catch (\Throwable $th) {
@@ -5304,10 +5312,13 @@ DNS-over-HTTPS with IP:
public function delxr($i) public function delxr($i)
{ {
$r = $this->getXray(); $r = $this->getXray();
$st = $this->getXrayStats();
foreach ($r['inbounds'][0]['settings']['clients'] as $k => $v) { foreach ($r['inbounds'][0]['settings']['clients'] as $k => $v) {
if ($i == $k) { if ($i == $k) {
unset($r['inbounds'][0]['settings']['clients'][$k]); unset($r['inbounds'][0]['settings']['clients'][$k]);
unset($st['users'][$k]);
$this->setXrayStats($st);
$this->restartXray($r); $this->restartXray($r);
$this->adguardXrayClients(); $this->adguardXrayClients();
break; break;
@@ -5415,10 +5426,7 @@ DNS-over-HTTPS with IP:
public function resetXrUser($i) public function resetXrUser($i)
{ {
$c = $this->getXrayStats(); $c = $this->getXrayStats();
$c['clients'][$i]['global'] = [ unset($c['users'][$i]);
'download' => 0,
'upload' => 0,
];
$this->restartXray($this->getXray()); $this->restartXray($this->getXray());
$this->userXr($i); $this->userXr($i);
} }
@@ -5751,7 +5759,6 @@ DNS-over-HTTPS with IP:
'callback_data' => '/addLinkDomain', 'callback_data' => '/addLinkDomain',
], ],
]; ];
$ip_count = $p['ip_count'] ?: 1;
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] == 'Reality' ? $this->i18n('on') : $this->i18n('off')), 'text' => $this->i18n('Reality') . ' ' . ($p['transport'] == 'Reality' ? $this->i18n('on') : $this->i18n('off')),
@@ -5761,6 +5768,9 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('Websocket') . ' ' . ($p['transport'] != 'Reality' ? $this->i18n('on') : $this->i18n('off')), 'text' => $this->i18n('Websocket') . ' ' . ($p['transport'] != 'Reality' ? $this->i18n('on') : $this->i18n('off')),
'callback_data' => "/changeTransport 1", 'callback_data' => "/changeTransport 1",
], ],
];
$ip_count = $p['ip_count'] ?: 1;
$data[] = [
[ [
'text' => $this->i18n('ip limit') . ' ' . ($p['ip_limit'] ? ": {$p['ip_limit']} sec & $ip_count" : $this->i18n('off')), 'text' => $this->i18n('ip limit') . ' ' . ($p['ip_limit'] ? ": {$p['ip_limit']} sec & $ip_count" : $this->i18n('off')),
'callback_data' => "/setIpLimit", 'callback_data' => "/setIpLimit",
@@ -6644,7 +6654,7 @@ DNS-over-HTTPS with IP:
if (!empty($route['rules'])) { if (!empty($route['rules'])) {
foreach ($route['rules'] as $k => $v) { foreach ($route['rules'] as $k => $v) {
if (!empty($v['addruleset'])) { if (!empty($v['addruleset'])) {
$t[$v['outbound']] = $k; $t[$v['outbound'] ?: 'block'] = $k;
} }
} }
$p = $this->getPacConf(); $p = $this->getPacConf();
+3
View File
@@ -1,3 +1,6 @@
22.02.2025 v2.13
- vless: улучшение сбора статы
- vless: фикс добавлениея правил srs для block outbound
11.02.2025 v2.12 11.02.2025 v2.12
- vless: хранение статы в отдельном файле - vless: хранение статы в отдельном файле
- vless ip limit: возможность указать кол-во айпи - vless ip limit: возможность указать кол-во айпи