Compare commits

..

19 Commits

Author SHA1 Message Date
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
7 changed files with 53 additions and 39 deletions
+38 -20
View File
@@ -755,11 +755,11 @@ class Bot
'download' => 0,
'upload' => 0,
];
foreach ($p['clients'] as $k => $v) {
$p['clients'][$k]['global']['download'] += $v['session']['download'];
$p['clients'][$k]['session']['download'] = 0;
$p['clients'][$k]['global']['upload'] += $v['session']['upload'];
$p['clients'][$k]['session']['upload'] = 0;
foreach ($p['users'] as $k => $v) {
$p['users'][$k]['global']['download'] += $v['session']['download'];
$p['users'][$k]['session']['download'] = 0;
$p['users'][$k]['global']['upload'] += $v['session']['upload'];
$p['users'][$k]['session']['upload'] = 0;
}
$this->setXrayStats($p);
}
@@ -993,7 +993,7 @@ class Bot
{
$r = $this->send(
$this->input['chat'],
"@{$this->input['username']} enter pass",
"@{$this->input['username']} enter password",
$this->input['message_id'],
reply: 'enter password',
);
@@ -1011,7 +1011,7 @@ class Bot
$this->input['chat'],
"@{$this->input['username']} enter name",
$this->input['message_id'],
reply: 'enter password',
reply: 'enter name',
);
$_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'],
@@ -1357,14 +1357,22 @@ class Bot
'upload' => $tu,
];
if (!empty($users = $x['inbounds'][0]['settings']['clients'])) {
$tmp = [];
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;
$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'] = [
'download' => $d,
'upload' => $u,
$tmp[$k] = [
'session' => [
'download' => $d,
'upload' => $u,
],
'global' => [
'download' => $p['users'][$k]['global']['download'],
'upload' => $p['users'][$k]['global']['upload'],
]
];
}
$p['users'] = $tmp;
}
$this->setXrayStats($p);
} catch (\Throwable $th) {
@@ -5304,10 +5312,13 @@ DNS-over-HTTPS with IP:
public function delxr($i)
{
$r = $this->getXray();
$r = $this->getXray();
$st = $this->getXrayStats();
foreach ($r['inbounds'][0]['settings']['clients'] as $k => $v) {
if ($i == $k) {
unset($r['inbounds'][0]['settings']['clients'][$k]);
unset($st['users'][$k]);
$this->setXrayStats($st);
$this->restartXray($r);
$this->adguardXrayClients();
break;
@@ -5415,10 +5426,7 @@ DNS-over-HTTPS with IP:
public function resetXrUser($i)
{
$c = $this->getXrayStats();
$c['clients'][$i]['global'] = [
'download' => 0,
'upload' => 0,
];
unset($c['users'][$i]);
$this->restartXray($this->getXray());
$this->userXr($i);
}
@@ -5600,6 +5608,7 @@ DNS-over-HTTPS with IP:
<code>~block~</code>
<code>~warp~</code>
<code>~dns~</code>
<code>~dnspath~</code>
<code>~uid~</code>
<code>~domain~</code>
<code>~directdomain~</code>
@@ -5751,7 +5760,6 @@ DNS-over-HTTPS with IP:
'callback_data' => '/addLinkDomain',
],
];
$ip_count = $p['ip_count'] ?: 1;
$data[] = [
[
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] == 'Reality' ? $this->i18n('on') : $this->i18n('off')),
@@ -5761,6 +5769,9 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('Websocket') . ' ' . ($p['transport'] != 'Reality' ? $this->i18n('on') : $this->i18n('off')),
'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')),
'callback_data' => "/setIpLimit",
@@ -6010,8 +6021,8 @@ DNS-over-HTTPS with IP:
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
if (empty($v['off']) && $v['email'] == $m['email']) {
require __DIR__ . '/config.php';
foreach ($c['admin'] as $k => $v) {
$this->send($v, "vless: {$m['email']} is turned off (limit by one IP)");
foreach ($c['admin'] as $admin) {
$this->send($admin, "vless: {$m['email']} is turned off (limit by one IP)");
}
unset($this->pool[$m['email']]);
$this->switchXr($k, 1);
@@ -6487,6 +6498,7 @@ DNS-over-HTTPS with IP:
'"~package~"' => json_encode(array_keys(array_filter($pac['packagelist'] ?: []))),
'"~subnet~"' => json_encode(array_keys(array_filter($pac['subnetlist'] ?: []))),
'~dns~' => "https://$domain/dns-query$hash/$uid",
'~dnspath~' => "/dns-query$hash/$uid",
'~uid~' => $uid,
'~domain~' => $domain,
'~directdomain~' => $pac['domain'],
@@ -6644,7 +6656,7 @@ DNS-over-HTTPS with IP:
if (!empty($route['rules'])) {
foreach ($route['rules'] as $k => $v) {
if (!empty($v['addruleset'])) {
$t[$v['outbound']] = $k;
$t[$v['outbound'] ?: 'block'] = $k;
}
}
$p = $this->getPacConf();
@@ -6845,7 +6857,13 @@ DNS-over-HTTPS with IP:
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)
+2 -2
View File
@@ -432,7 +432,7 @@ services:
ipv4_address: 10.10.0.12
logging: *default-logging
wp:
image: mercurykd/vpnbot-wp:1.2
image: mercurykd/vpnbot-wp:1.3
build:
dockerfile: dockerfile/warp.dockerfile
args:
@@ -442,7 +442,7 @@ services:
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- ./config/.profile:/root/.ashrc:ro
- ./config/.profile:/root/.bashrc:ro
- ./ssh:/ssh
- ./config/sshd_config:/etc/ssh/sshd_config
- ./config:/config
+3 -13
View File
@@ -1,16 +1,6 @@
FROM ubuntu:22.04 AS build
RUN apt update && apt install -y curl gpg lsb-release \
FROM ubuntu:22.04
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 \
&& 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
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 \
&& apt update && apt install -y cloudflare-warp \
&& mkdir /root/.ssh
+1 -1
View File
@@ -32,7 +32,7 @@ up: # консоль сервиса
ad: # консоль сервиса
docker compose exec ad /bin/sh
wp: # консоль сервиса
docker compose exec wp /bin/sh
docker compose exec wp bash
proxy: # консоль сервиса
docker compose exec proxy /bin/sh
tg: # консоль сервиса
+4 -3
View File
@@ -1,9 +1,10 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
ssh-keygen -A
exec /usr/sbin/sshd -D -e "$@" &
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
off=$(cat /config/pac.json | jq -r .warpoff)
key=$(cat /config/pac.json | jq -r .warp)
if [ "$off" == 'null' ]
if [ "$off" = 'null' ]
then
warp-svc > /dev/null &
sleep 3
Binary file not shown.
+5
View File
@@ -1,3 +1,8 @@
02.03.2025 v2.14
- vless ip limit: фикс выключения юзера
22.02.2025 v2.13
- vless: улучшение сбора статы
- vless: фикс добавления правил srs для block outbound
11.02.2025 v2.12
- vless: хранение статы в отдельном файле
- vless ip limit: возможность указать кол-во айпи