Compare commits

..

24 Commits

Author SHA1 Message Date
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
mercury 1b93d41421 cyclical rebooting panel adguardhome fix 2025-04-07 00:22:50 +04:00
mercury e41c8e30a4 fix warp 2025-04-06 23:57:46 +04:00
mercury 260f988360 Merge branch 'dev' of github.com:mercurykd/vpnbot into dev 2025-04-05 00:38:54 +04:00
mercury ca4905220d np/oc the domain is preserved when transferring 2025-04-05 00:36:08 +04:00
Konstantin 08c5ff136e Merge pull request #38 from legiz-ru/dev
new variable ~dnspath~
2025-03-04 15:45:18 +04:00
legiz-ru 8709531717 new variable ~dnspath~
new variable ~dnspath~ for client templates (required for future release sing-box 1.12)
2025-03-04 12:41:23 +03:00
Konstantin 71f53c3575 Merge pull request #37 from legiz-ru/dev
update singbox 1.11.4 windows x64
2025-03-04 12:16:19 +04:00
legiz-ru 2607f1f264 update singbox 1.11.4 windows x64 2025-03-04 10:46:56 +03:00
mercury a94cab7dc1 fix ip limit user off 2025-03-02 18:41:18 +04:00
mercury 694d446402 update version 2025-02-22 18:56:42 +04:00
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
9 changed files with 84 additions and 52 deletions
+53 -31
View File
@@ -40,7 +40,7 @@ class Bot
$this->reg = '~' . implode('|', [ $this->reg = '~' . implode('|', [
'GET / HTTP', 'GET / HTTP',
'GET /favicon.ico HTTP', 'GET /favicon.ico HTTP',
preg_quote($this->getHashBot()) preg_quote($this->getHashBot(1))
]) . '~'; ]) . '~';
} }
@@ -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'],
@@ -1188,8 +1188,7 @@ class Bot
$this->ssh('ssserver -v -d -c /config.json', 'ss'); $this->ssh('ssserver -v -d -c /config.json', 'ss');
$this->ssh('sslocal -v -d -c /config.json', 'proxy'); $this->ssh('sslocal -v -d -c /config.json', 'proxy');
$this->sd($c, 1); if (empty($nomenu)) {
if (!empty($nomenu)) {
$this->menu('ss'); $this->menu('ss');
} }
} }
@@ -1357,14 +1356,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 +5311,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 +5425,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);
} }
@@ -5600,6 +5607,7 @@ DNS-over-HTTPS with IP:
<code>~block~</code> <code>~block~</code>
<code>~warp~</code> <code>~warp~</code>
<code>~dns~</code> <code>~dns~</code>
<code>~dnspath~</code>
<code>~uid~</code> <code>~uid~</code>
<code>~domain~</code> <code>~domain~</code>
<code>~directdomain~</code> <code>~directdomain~</code>
@@ -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",
@@ -5988,7 +5998,6 @@ DNS-over-HTTPS with IP:
public function frequencyAnalyze($line, $pac) public function frequencyAnalyze($line, $pac)
{ {
preg_match('~(?<date>.+)\sfrom\s(?<ip>\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?<email>.+))~', $line, $m);
if (!empty($this->pool)) { if (!empty($this->pool)) {
foreach ($this->pool as $i => $j) { foreach ($this->pool as $i => $j) {
if (!empty($j['ips'])) { if (!empty($j['ips'])) {
@@ -6000,6 +6009,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'])) { if (!empty($m['ip']) && !empty($m['email'])) {
$ip = ip2long($m['ip']); $ip = ip2long($m['ip']);
if (!empty($this->pool[$m['email']]['ip']) && $this->pool[$m['email']]['ip'] != $ip) { if (!empty($this->pool[$m['email']]['ip']) && $this->pool[$m['email']]['ip'] != $ip) {
@@ -6010,19 +6022,20 @@ DNS-over-HTTPS with IP:
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) { foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
if (empty($v['off']) && $v['email'] == $m['email']) { if (empty($v['off']) && $v['email'] == $m['email']) {
require __DIR__ . '/config.php'; require __DIR__ . '/config.php';
foreach ($c['admin'] as $k => $v) { foreach ($c['admin'] as $admin) {
$this->send($v, "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']]); unset($this->pool[$m['email']]);
$this->switchXr($k, 1);
$flag = 1;
break; break;
} }
} }
} }
if (empty($flag)) { $this->pool[$m['email']]['ip'] = $ip;
$this->pool[$m['email']]['ip'] = $ip;
}
} }
} }
@@ -6487,6 +6500,7 @@ DNS-over-HTTPS with IP:
'"~package~"' => json_encode(array_keys(array_filter($pac['packagelist'] ?: []))), '"~package~"' => json_encode(array_keys(array_filter($pac['packagelist'] ?: []))),
'"~subnet~"' => json_encode(array_keys(array_filter($pac['subnetlist'] ?: []))), '"~subnet~"' => json_encode(array_keys(array_filter($pac['subnetlist'] ?: []))),
'~dns~' => "https://$domain/dns-query$hash/$uid", '~dns~' => "https://$domain/dns-query$hash/$uid",
'~dnspath~' => "/dns-query$hash/$uid",
'~uid~' => $uid, '~uid~' => $uid,
'~domain~' => $domain, '~domain~' => $domain,
'~directdomain~' => $pac['domain'], '~directdomain~' => $pac['domain'],
@@ -6644,7 +6658,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();
@@ -6793,14 +6807,16 @@ DNS-over-HTTPS with IP:
$this->ssh("nginx -s reload 2>&1", 'up'); $this->ssh("nginx -s reload 2>&1", 'up');
} }
public function getHashBot() public function getHashBot($notset = false)
{ {
$p = $this->getPacConf(); $p = $this->getPacConf();
if (!empty($p['hashbot'])) { if (!empty($p['hashbot'])) {
return $p['hashbot']; return $p['hashbot'];
} }
$p['hashbot'] = substr(hash('sha256', $this->key), 0, 8); $p['hashbot'] = substr(hash('sha256', $this->key), 0, 8);
$this->setPacConf($p); if (empty($notset)) {
$this->setPacConf($p);
}
return $p['hashbot']; return $p['hashbot'];
} }
@@ -6845,7 +6861,13 @@ DNS-over-HTTPS with IP:
public function getHashSubdomain($subdomain) public function getHashSubdomain($subdomain)
{ {
return $this->getPacConf()["{$subdomain}_domain"] ?: substr(hash('sha256', "$subdomain{$this->key}"), 0, 8); $p = $this->getPacConf();
if (!empty($p["{$subdomain}_domain"])) {
return $p["{$subdomain}_domain"];
}
$p["{$subdomain}_domain"] = substr(hash('sha256', "$subdomain{$this->key}"), 0, 8);
$this->setPacConf($p);
return $p["{$subdomain}_domain"];
} }
public function addWg($page) public function addWg($page)
+1 -1
View File
@@ -38,7 +38,7 @@ switch (true) {
// adguard cookie // adguard cookie
case preg_match('~^' . preg_quote("/webapp$hash/check") . '~', $_SERVER['REQUEST_URI']) && $webapp: case preg_match('~^' . preg_quote("/webapp$hash/check") . '~', $_SERVER['REQUEST_URI']) && $webapp:
setcookie('c', substr(hash('sha256', $c['key']), 0, 8), 0, '/'); setcookie('c', $hash, 0, '/');
echo "/adguard$hash/"; echo "/adguard$hash/";
break; break;
+1
View File
@@ -72,6 +72,7 @@
"uuid": "~uid~", "uuid": "~uid~",
"network": "tcp", "network": "tcp",
"flow": "xtls-rprx-vision", "flow": "xtls-rprx-vision",
"udp": true,
"tls": true, "tls": true,
"reality-opts": { "reality-opts": {
"public-key": "~public_key~", "public-key": "~public_key~",
+3 -3
View File
@@ -147,7 +147,7 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
service: service:
image: mercurykd/vpnbot-php:1.6 image: mercurykd/vpnbot-php:1.7
build: build:
dockerfile: dockerfile/php.dockerfile dockerfile: dockerfile/php.dockerfile
args: args:
@@ -432,7 +432,7 @@ services:
ipv4_address: 10.10.0.12 ipv4_address: 10.10.0.12
logging: *default-logging logging: *default-logging
wp: wp:
image: mercurykd/vpnbot-wp:1.2 image: mercurykd/vpnbot-wp:1.3
build: build:
dockerfile: dockerfile/warp.dockerfile dockerfile: dockerfile/warp.dockerfile
args: args:
@@ -442,7 +442,7 @@ services:
devices: devices:
- /dev/net/tun:/dev/net/tun - /dev/net/tun:/dev/net/tun
volumes: volumes:
- ./config/.profile:/root/.ashrc:ro - ./config/.profile:/root/.bashrc:ro
- ./ssh:/ssh - ./ssh:/ssh
- ./config/sshd_config:/etc/ssh/sshd_config - ./config/sshd_config:/etc/ssh/sshd_config
- ./config:/config - ./config:/config
+3 -13
View File
@@ -1,16 +1,6 @@
FROM ubuntu:22.04 AS build FROM ubuntu:22.04
RUN apt update && apt install -y curl gpg lsb-release \ RUN apt update && apt install -y curl gpg socat jq lsb-release openssh-server \
&& curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg \ && curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list \ && echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list \
&& apt update && apt install -y cloudflare-warp && apt update && apt install -y cloudflare-warp \
FROM alpine:3.17
ARG GLIBC_VERSION=2.34-r0
COPY --from=build /usr/bin/warp-cli /usr/bin/warp-svc /usr/local/bin/
RUN apk add --no-cache dbus-libs wget socat openssh-server jq curl \
&& mkdir /tmp/glibc-pkgs \
&& for PKG in glibc-$GLIBC_VERSION.apk glibc-bin-$GLIBC_VERSION.apk; do wget -q --directory-prefix /tmp/glibc-pkgs https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/$PKG; done \
&& apk add --no-cache --allow-untrusted --force-overwrite /tmp/glibc-pkgs/* \
&& rm -rf /tmp/glibc-pkgs \
&& /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib \
&& mkdir /root/.ssh && mkdir /root/.ssh
+3 -1
View File
@@ -32,7 +32,7 @@ up: # консоль сервиса
ad: # консоль сервиса ad: # консоль сервиса
docker compose exec ad /bin/sh docker compose exec ad /bin/sh
wp: # консоль сервиса wp: # консоль сервиса
docker compose exec wp /bin/sh docker compose exec wp bash
proxy: # консоль сервиса proxy: # консоль сервиса
docker compose exec proxy /bin/sh docker compose exec proxy /bin/sh
tg: # консоль сервиса tg: # консоль сервиса
@@ -41,6 +41,8 @@ xr: # консоль сервиса
docker compose exec xr /bin/sh docker compose exec xr /bin/sh
oc: # консоль сервиса oc: # консоль сервиса
docker compose exec oc /bin/sh docker compose exec oc /bin/sh
service: # консоль сервиса
docker compose exec service /bin/sh
clean: clean:
docker image prune docker image prune
docker builder prune docker builder prune
+4 -3
View File
@@ -1,9 +1,10 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys cat /ssh/key.pub > /root/.ssh/authorized_keys
ssh-keygen -A echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
exec /usr/sbin/sshd -D -e "$@" & echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
off=$(cat /config/pac.json | jq -r .warpoff) off=$(cat /config/pac.json | jq -r .warpoff)
key=$(cat /config/pac.json | jq -r .warp) key=$(cat /config/pac.json | jq -r .warp)
if [ "$off" == 'null' ] if [ "$off" = 'null' ]
then then
warp-svc > /dev/null & warp-svc > /dev/null &
sleep 3 sleep 3
Binary file not shown.
+16
View File
@@ -1,3 +1,19 @@
18.04.2025 v2.18
- фикс отсутствия ssl при первом старте
- iplimit уведомляет без отключения пользователя
- включение udp в mihomo-шаблоне
- удаление лишнего образа пхп
07.04.2025 v2.17
- фикс циклической перезагрузки панели adguardHome
07.04.2025 v2.16
- фикс warp
07.04.2025 v2.15
- миграция поддоменов np/oc вместе в с бэкапом
02.03.2025 v2.14
- vless ip limit: фикс выключения юзера
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: возможность указать кол-во айпи