Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5791cabfb5 | |||
| 49d2d21f41 | |||
| 5263de514e | |||
| 9da810ba3d | |||
| b663eca445 | |||
| f8f95e22ac | |||
| 30f0f8c5f0 | |||
| 741f402ca1 | |||
| ef3d40c098 | |||
| ded85fb79f | |||
| b5ca5fbf93 | |||
| 570420274e | |||
| baaf0e2d01 | |||
| be8bec6a7d | |||
| acaec83877 | |||
| 8cf6c512cb | |||
| 880a8de7e5 | |||
| 9662fc9d55 | |||
| 561bcb7023 | |||
| 9d7c735f79 | |||
| 8091eb4971 | |||
| 967353bcd6 | |||
| 9f218c9f32 | |||
| 6a6bd3a4d2 | |||
| bc8b0ff033 | |||
| 624713347a | |||
| 52738c0491 | |||
| 277b00da87 | |||
| 455b9cea07 | |||
| 88f8c1c4c2 | |||
| 6017bc4008 | |||
| 6631ea5cc2 | |||
| 09d49fd0fb | |||
| 6766a56440 | |||
| 0c3a6cc90e | |||
| c0750c930a | |||
| 45e1455d48 | |||
| 7582dc50c2 | |||
| bb1ac60acc | |||
| 256e43352a |
+559
-100
@@ -9,6 +9,8 @@ class Bot
|
||||
public $limit;
|
||||
public $key;
|
||||
public $file;
|
||||
public $dns;
|
||||
public $mtu;
|
||||
|
||||
public function __construct($key, $i18n)
|
||||
{
|
||||
@@ -22,6 +24,7 @@ class Bot
|
||||
$this->i18n = $i18n;
|
||||
$this->language = $this->getPacConf()['language'] ?: 'en';
|
||||
$this->dns = '1.1.1.1, 8.8.8.8';
|
||||
$this->mtu = 1350;
|
||||
$this->limit = $this->getPacConf()['limitpage'] ?: 5;
|
||||
$this->adguard = '/config/AdGuardHome.yaml';
|
||||
$this->update = '/update/json';
|
||||
@@ -130,6 +133,9 @@ class Bot
|
||||
case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m):
|
||||
$this->changeWG($m[1]);
|
||||
break;
|
||||
case preg_match('~^/mirror$~', $this->input['message'], $m):
|
||||
$this->menu('mirror');
|
||||
break;
|
||||
case preg_match('~^/id$~', $this->input['message'], $m):
|
||||
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
||||
break;
|
||||
@@ -139,6 +145,15 @@ class Bot
|
||||
case preg_match('~^/mtproto$~', $this->input['callback'], $m):
|
||||
$this->mtproto();
|
||||
break;
|
||||
case preg_match('~^/deleteAll (\w+)$~', $this->input['callback'], $m):
|
||||
$this->deleteAll($m[1]);
|
||||
break;
|
||||
case preg_match('~^/exportList (\w+)$~', $this->input['callback'], $m):
|
||||
$this->exportList($m[1]);
|
||||
break;
|
||||
case preg_match('~^/deleteYes (\w+)$~', $this->input['callback'], $m):
|
||||
$this->deleteYes($m[1]);
|
||||
break;
|
||||
case preg_match('~^/addCommunityFilter$~', $this->input['callback'], $m):
|
||||
$this->addCommunityFilter();
|
||||
break;
|
||||
@@ -184,6 +199,9 @@ class Bot
|
||||
case preg_match('~^/defaultDNS (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->defaultDNS(...explode('_', $m['arg']));
|
||||
break;
|
||||
case preg_match('~^/defaultMTU (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->defaultMTU(...explode('_', $m['arg']));
|
||||
break;
|
||||
case preg_match('~^/subnet (?P<arg>-?\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->subnet(...explode('_', $m['arg']));
|
||||
break;
|
||||
@@ -199,6 +217,9 @@ class Bot
|
||||
case preg_match('~^/changeAllowedIps (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->changeAllowedIps(...explode('_', $m['arg']));
|
||||
break;
|
||||
case preg_match('~^/changeMTU (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->changeMTU(...explode('_', $m['arg']));
|
||||
break;
|
||||
case preg_match('~^/calc$~', $this->input['callback'], $m):
|
||||
$this->calc();
|
||||
break;
|
||||
@@ -350,8 +371,8 @@ class Bot
|
||||
case preg_match('~^/deldomain$~', $this->input['callback'], $m):
|
||||
$this->delDomain();
|
||||
break;
|
||||
case preg_match('~^/(?P<action>change|delete)(?P<typelist>\w+) (?P<arg>[^\s]+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->listPacChange($m['typelist'], $m['action'], ...explode('_', $m['arg']));
|
||||
case preg_match('~^/(?P<action>change|delete)(?P<typelist>\w+) (?P<arg>\d+)$~', $this->input['callback'], $m):
|
||||
$this->listPacChange($m['typelist'], $m['action'], $m['arg']);
|
||||
break;
|
||||
case preg_match('~^/paczapret$~', $this->input['callback'], $m):
|
||||
$this->pacZapret();
|
||||
@@ -380,9 +401,18 @@ class Bot
|
||||
case preg_match('~^/xtlsblock(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xtlsblock($m[1] ?: 0);
|
||||
break;
|
||||
case preg_match('~^/routes(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->routes($m[1] ?: 0);
|
||||
break;
|
||||
case preg_match('~^/xtlswarp(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xtlswarp($m[1] ?: 0);
|
||||
break;
|
||||
case preg_match('~^/xtlsapp(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xtlsapp($m[1] ?: 0);
|
||||
break;
|
||||
case preg_match('~^/xtlsrulesset(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xtlsrulesset($m[1] ?: 0);
|
||||
break;
|
||||
case preg_match('~^/delTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m):
|
||||
$this->delTemplate($m[1], $m[2]);
|
||||
break;
|
||||
@@ -440,6 +470,9 @@ class Bot
|
||||
case preg_match('~^/import$~', $this->input['callback'], $m):
|
||||
$this->import();
|
||||
break;
|
||||
case preg_match('~^/importList (\w+)$~', $this->input['callback'], $m):
|
||||
$this->importList($m[1]);
|
||||
break;
|
||||
case preg_match('~^/rename (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||
$this->rename(...explode('_', $m['arg']));
|
||||
break;
|
||||
@@ -902,6 +935,46 @@ class Bot
|
||||
];
|
||||
}
|
||||
|
||||
public function importList($type)
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} send the export file:",
|
||||
$this->input['message_id'],
|
||||
reply: 'send the export file:',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'importListFile',
|
||||
'args' => [$type],
|
||||
];
|
||||
}
|
||||
|
||||
public function importListFile($text = '', $type)
|
||||
{
|
||||
$r = $this->request('getFile', ['file_id' => $this->input['file_id']]);
|
||||
$f = file_get_contents($this->file . $r['result']['file_path']);
|
||||
if (!empty($f)) {
|
||||
foreach (explode("\n", $f) as $v) {
|
||||
if (!empty($s = trim($v))) {
|
||||
$t = explode(';', $s);
|
||||
if ($type == 'rulessetlist') {
|
||||
if (preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $t[0])) {
|
||||
$list[$t[0]] = (bool) $t[1];
|
||||
}
|
||||
} else {
|
||||
$list[$t[0]] = (bool) $t[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$p = $this->getPacConf();
|
||||
$p[$type] = $list;
|
||||
$this->setPacConf($p);
|
||||
}
|
||||
$this->backXtlsList($type);
|
||||
}
|
||||
|
||||
public function timerClient(string $time, int $client)
|
||||
{
|
||||
$clients = $this->readClients();
|
||||
@@ -948,22 +1021,16 @@ class Bot
|
||||
|
||||
public function checkBackup()
|
||||
{
|
||||
$c = time();
|
||||
$conf = $this->getPacConf();
|
||||
$time = $conf['backup'];
|
||||
if ($time) {
|
||||
preg_match('~(\d+\s\w+)(?:\s+)?/(?:\s+)?(\d{2}:\d{2})~', $time, $m);
|
||||
$period = strtotime($m[1]) - $c;
|
||||
$start = strtotime($m[2]);
|
||||
$last = $conf['pinbackup'];
|
||||
if ($last) {
|
||||
[$pin, $time] = explode('/', $last);
|
||||
if ($c - $time >= $period) {
|
||||
$this->pinAdmin($pin, 1);
|
||||
$this->pinBackup();
|
||||
return;
|
||||
$c = $this->getPacConf();
|
||||
$now = strtotime(date('Y-m-d H:i'));
|
||||
if (!empty($c['backup'])) {
|
||||
[$start, $period] = explode('/', $c['backup']);
|
||||
$start = strtotime($start);
|
||||
$period = strtotime($period, 0);
|
||||
if ($now - $start >= $period && ($now - $start) % $period == 0) {
|
||||
if (!empty($c['pinbackup'])) {
|
||||
$this->pinAdmin($c['pinbackup'], 1);
|
||||
}
|
||||
} elseif ($c - $start > 0 && $c - $start < 30) {
|
||||
$this->pinBackup();
|
||||
}
|
||||
}
|
||||
@@ -984,10 +1051,10 @@ class Bot
|
||||
require __DIR__ . '/config.php';
|
||||
$conf = $this->getPacConf();
|
||||
$bot = $this->request('getMyName', [])['result']['name'];
|
||||
$pin = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id'];
|
||||
$conf['pinbackup'] = "$pin/" . time();
|
||||
$conf['pinbackup'] = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id'];
|
||||
$conf['backup'] = implode(' / ', [date('Y-m-d H:i'), trim(explode('/', $conf['backup'])[1])]);
|
||||
$this->setPacConf($conf);
|
||||
$this->pinAdmin($pin);
|
||||
$this->pinAdmin($conf['pinbackup']);
|
||||
}
|
||||
|
||||
public function checkVersion()
|
||||
@@ -1005,7 +1072,14 @@ class Bot
|
||||
$diff = array_slice($diff, 0, 10);
|
||||
if (!empty($diff)) {
|
||||
foreach ($c['admin'] as $k => $v) {
|
||||
$this->send($v, implode("\n", $diff));
|
||||
$this->send($v, implode("\n", $diff), 0, [
|
||||
[
|
||||
[
|
||||
'text' => 'changelog',
|
||||
'web_app' => ['url' => "https://raw.githubusercontent.com/mercurykd/vpnbot/$b/version"],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1472,26 +1546,30 @@ class Bot
|
||||
$this->menu('config');
|
||||
}
|
||||
|
||||
public function qrPeer($client)
|
||||
public function sendQr($name, $code, $title = false)
|
||||
{
|
||||
$cl = $client;
|
||||
$client = $this->readClients()[$client];
|
||||
$name = $this->getName($client['interface']);
|
||||
if ($this->getWGType() == 'awg') {
|
||||
$sl = $this->getAmneziaShortLink($client);
|
||||
$code = preg_replace('/^vpn:\/\//', '', $sl);
|
||||
} else {
|
||||
$code = $this->createConfig($client);
|
||||
}
|
||||
$qr = preg_replace(['~\s+~', '~\(~', '~\)~'], ['_'], $name);
|
||||
$qr_file = __DIR__ . "/qr/$qr.png";
|
||||
exec("qrencode -t png -o $qr_file '$code'");
|
||||
$r = $this->sendPhoto(
|
||||
$this->input['chat'],
|
||||
curl_file_create($qr_file),
|
||||
($this->getWGType() == 'awg') ? "$name for AmneziaVPN" : $name
|
||||
$title ?: $name
|
||||
);
|
||||
unlink($qr_file);
|
||||
}
|
||||
|
||||
public function qrPeer($client)
|
||||
{
|
||||
$cl = $client;
|
||||
$client = $this->readClients()[$client];
|
||||
$name = $this->getName($client['interface']);
|
||||
if ($this->getWGType() == 'awg') {
|
||||
$this->sendQr($name, preg_replace('/^vpn:\/\//', '', $this->getAmneziaShortLink($client)), "$name for AmneziaVPN");
|
||||
$this->sendQr($name, $this->createConfig($client), "$name for AmneziaWG");
|
||||
} else {
|
||||
$this->sendQr($name, $this->createConfig($client), "$name for Wireguard");
|
||||
}
|
||||
if ($this->getPacConf()['blinkmenu']) {
|
||||
$this->delete($this->input['chat'], $this->input['message_id']);
|
||||
$this->input['message_id'] = $this->send($this->input['chat'], '.')['result']['message_id'];
|
||||
@@ -2135,12 +2213,25 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function include($type)
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} list domains separated by commas",
|
||||
$this->input['message_id'],
|
||||
reply: 'list domains separated by commas',
|
||||
);
|
||||
switch ($type) {
|
||||
case 'rulessetlist':
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} [direct | block | proxy]:time:URL",
|
||||
$this->input['message_id'],
|
||||
reply: '[direct | block | proxy]:time:URL',
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} list domains separated by commas",
|
||||
$this->input['message_id'],
|
||||
reply: 'list domains separated by commas',
|
||||
);
|
||||
break;
|
||||
}
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'callback' => 'addInclude',
|
||||
@@ -2150,6 +2241,10 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function addInclude(string $domains, $type)
|
||||
{
|
||||
if ($type == 'rulessetlist' && !preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $domains)) {
|
||||
$this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy]:time:URL');
|
||||
return;
|
||||
}
|
||||
$domains = explode(',', $domains);
|
||||
$domains = array_filter($domains, fn($x) => !empty(trim($x)));
|
||||
if (!empty($domains)) {
|
||||
@@ -2179,6 +2274,14 @@ DNS-over-HTTPS with IP:
|
||||
$this->xrayUpdateRules();
|
||||
$this->xtlswarp();
|
||||
break;
|
||||
case 'packagelist':
|
||||
$this->xrayUpdateRules();
|
||||
$this->xtlsapp();
|
||||
break;
|
||||
case 'rulessetlist':
|
||||
$this->xrayUpdateRules();
|
||||
$this->xtlsrulesset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2436,6 +2539,7 @@ DNS-over-HTTPS with IP:
|
||||
$bt = $c[$this->getInstanceWG(1) . 'blocktorrent'];
|
||||
$ex = $c[$this->getInstanceWG(1) . 'exchange'];
|
||||
$dns = $c[$this->getInstanceWG(1) . 'dns'];
|
||||
$mtu = $c[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu;
|
||||
$am = $c[$this->getInstanceWG(1) . 'amnezia'];
|
||||
$data = [
|
||||
[
|
||||
@@ -2463,6 +2567,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $this->i18n('defaultDNS') . ': ' . ($dns ?: $this->dns),
|
||||
'callback_data' => "/defaultDNS $page",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('defaultMTU') . ': ' . $mtu,
|
||||
'callback_data' => "/defaultMTU $page",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
@@ -2550,6 +2658,38 @@ DNS-over-HTTPS with IP:
|
||||
];
|
||||
}
|
||||
|
||||
public function defaultMTU($page = 0)
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter MTU",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter MTU',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'setMTU',
|
||||
'args' => [$page],
|
||||
];
|
||||
}
|
||||
|
||||
public function changeMTU($client, $page = 0)
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter MTU",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter MTU',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'changeClientMTU',
|
||||
'args' => [$client, $page],
|
||||
];
|
||||
}
|
||||
|
||||
public function setDNS($text, $page = 0)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
@@ -2562,6 +2702,30 @@ DNS-over-HTTPS with IP:
|
||||
$this->menu('wg', $page);
|
||||
}
|
||||
|
||||
public function setMTU($text, $page = 0)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
if ($text) {
|
||||
$c[$this->getInstanceWG(1) . 'mtu'] = $text;
|
||||
} else {
|
||||
unset($c[$this->getInstanceWG(1) . 'mtu']);
|
||||
}
|
||||
$this->setPacConf($c);
|
||||
$this->menu('wg', $page);
|
||||
}
|
||||
|
||||
public function changeClientMTU($text, $client, $page = 0)
|
||||
{
|
||||
$clients = $this->readClients();
|
||||
if (!empty((int) $text)) {
|
||||
$clients[$client]['interface']['MTU'] = $text;
|
||||
} else {
|
||||
unset($clients[$client]['interface']['MTU']);
|
||||
}
|
||||
$this->saveClients($clients);
|
||||
$this->menu('client', "{$client}_$page");
|
||||
}
|
||||
|
||||
public function subnetAdd($wgpage, $page)
|
||||
{
|
||||
$r = $this->send(
|
||||
@@ -2880,6 +3044,12 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/changeAllowedIps {$client}_$page",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('MTU') . " " . ($clients[$client]['interface']['MTU'] ?: $this->getPacConf()[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu),
|
||||
'callback_data' => "/changeMTU {$client}_$page",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('delete'),
|
||||
@@ -3058,15 +3228,132 @@ DNS-over-HTTPS with IP:
|
||||
);
|
||||
}
|
||||
|
||||
public function deleteYes($type)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
unset($c[$type]);
|
||||
$this->setPacConf($c);
|
||||
switch ($type) {
|
||||
case 'includelist':
|
||||
$this->pacUpdate();
|
||||
break;
|
||||
case 'blocklist':
|
||||
$this->xtlsblock();
|
||||
break;
|
||||
case 'warplist':
|
||||
$this->xtlswarp();
|
||||
break;
|
||||
case 'packagelist':
|
||||
$this->xtlsapp();
|
||||
break;
|
||||
case 'rulessetlist':
|
||||
$this->xtlsrulesset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAll($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'includelist':
|
||||
$dir = 'PAC';
|
||||
break;
|
||||
case 'warplist':
|
||||
$dir = 'WARP';
|
||||
break;
|
||||
case 'blocklist':
|
||||
$dir = 'BLOCK';
|
||||
break;
|
||||
case 'packagelist':
|
||||
$dir = 'PACKAGE';
|
||||
break;
|
||||
case 'rulessetlist':
|
||||
$dir = 'rulesset';
|
||||
break;
|
||||
}
|
||||
$text = <<<text
|
||||
Menu -> $dir -> delete all
|
||||
text;
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('yes'),
|
||||
'callback_data' => "/deleteYes $type",
|
||||
],
|
||||
];
|
||||
switch ($type) {
|
||||
case 'includelist':
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/pacMenu 0",
|
||||
],
|
||||
];
|
||||
break;
|
||||
case 'warplist':
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xtlswarp",
|
||||
],
|
||||
];
|
||||
break;
|
||||
case 'blocklist':
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xtlsblock",
|
||||
],
|
||||
];
|
||||
break;
|
||||
case 'packagelist':
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xtlsapp",
|
||||
],
|
||||
];
|
||||
break;
|
||||
case 'rulessetlist':
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xtlsrulesset",
|
||||
],
|
||||
];
|
||||
break;
|
||||
}
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
$text,
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function exportList($type)
|
||||
{
|
||||
$domains = $this->getPacConf()[$type];
|
||||
if (!empty($domains)) {
|
||||
foreach ($domains as $k => $v) {
|
||||
$text .= "$k;$v\n";
|
||||
}
|
||||
$this->sendFile(
|
||||
$this->input['chat'],
|
||||
new CURLStringFile($text, "$type.csv", 'application/csv'),
|
||||
to: $this->input['message_id'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function xtlsblock($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> block list';
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> block list';
|
||||
|
||||
$data = $this->listPac('blocklist', $page, 'xtlsblock');
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xray",
|
||||
'callback_data' => "/routes",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
@@ -3079,13 +3366,13 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function xtlswarp($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> warp list';
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> warp list';
|
||||
|
||||
$data = $this->listPac('warplist', $page, 'xtlswarp');
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xray",
|
||||
'callback_data' => "/routes",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
@@ -3096,7 +3383,45 @@ DNS-over-HTTPS with IP:
|
||||
);
|
||||
}
|
||||
|
||||
public function listPac($type, $page, $menu)
|
||||
public function xtlsapp($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list';
|
||||
|
||||
$data = $this->listPac('packagelist', $page, 'xtlsapp');
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/routes",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function xtlsrulesset($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list';
|
||||
|
||||
$data = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1);
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/routes",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function listPac($type, $page, $menu, $basename = false)
|
||||
{
|
||||
$data[] = [
|
||||
[
|
||||
@@ -3106,22 +3431,23 @@ DNS-over-HTTPS with IP:
|
||||
];
|
||||
$domains = $this->getPacConf()[$type];
|
||||
if (!empty($domains)) {
|
||||
ksort($domains);
|
||||
$all = (int) ceil(count($domains) / $this->limit);
|
||||
$page = min($page, $all - 1);
|
||||
$page = $page < 0 ? $all - 1 : $page;
|
||||
$domains = array_slice($domains, $page * $this->limit, $this->limit, true);
|
||||
$i = 0;
|
||||
foreach ($domains as $k => $v) {
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n($v ? 'on' : 'off') . ' ' . idn_to_utf8($k),
|
||||
'callback_data' => "/change$type {$k}_{$this->limit}",
|
||||
'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . idn_to_utf8($k),
|
||||
'callback_data' => "/change$type $i",
|
||||
],
|
||||
[
|
||||
'text' => 'delete',
|
||||
'callback_data' => "/delete$type {$k}_{$this->limit}",
|
||||
'callback_data' => "/delete$type $i",
|
||||
],
|
||||
];
|
||||
$i++;
|
||||
}
|
||||
if ($all > 1) {
|
||||
$data[] = [
|
||||
@@ -3135,6 +3461,27 @@ DNS-over-HTTPS with IP:
|
||||
]
|
||||
];
|
||||
}
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('delete all'),
|
||||
'callback_data' => "/deleteAll $type",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('export'),
|
||||
'callback_data' => "/exportList $type",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('import'),
|
||||
'callback_data' => "/importList $type",
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('import'),
|
||||
'callback_data' => "/importList $type",
|
||||
],
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@@ -3142,14 +3489,20 @@ DNS-over-HTTPS with IP:
|
||||
public function listPacChange($type, $action, $key)
|
||||
{
|
||||
$conf = $this->getPacConf();
|
||||
ksort($conf[$type]);
|
||||
switch ($action) {
|
||||
case 'change':
|
||||
$conf[$type][$key] = !$conf[$type][$key];
|
||||
break;
|
||||
case 'delete':
|
||||
unset($conf[$type][$key]);
|
||||
$i = 0;
|
||||
foreach ($conf[$type] as $k => $v) {
|
||||
if ($key == $i) {
|
||||
switch ($action) {
|
||||
case 'change':
|
||||
$conf[$type][$k] = !$v;
|
||||
break;
|
||||
case 'delete':
|
||||
unset($conf[$type][$k]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$this->setPacConf($conf);
|
||||
$this->backXtlsList($type);
|
||||
@@ -3514,12 +3867,13 @@ DNS-over-HTTPS with IP:
|
||||
preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m);
|
||||
$cs = $m[1];
|
||||
preg_match('~^dns = ([^\n]+)~sm', $ocserv, $m);
|
||||
$dns = $m[1];
|
||||
$dns = $m[1];
|
||||
$pass = htmlspecialchars($pac['ocserv']);
|
||||
$text[] = "Menu -> OpenConnect";
|
||||
if (!empty($m[1])) {
|
||||
$text[] = "<code>https://oc.{$pac['domain']}/?$cs</code>";
|
||||
}
|
||||
$text[] = "password: <span class='tg-spoiler'>{$pac['ocserv']}</span>";
|
||||
$text[] = "password: <span class='tg-spoiler'>$pass</span>";
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('change secret'),
|
||||
@@ -3816,15 +4170,9 @@ DNS-over-HTTPS with IP:
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('block'),
|
||||
'callback_data' => "/xtlsblock",
|
||||
'text' => $this->i18n('routes'),
|
||||
'callback_data' => "/routes",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('warp'),
|
||||
'callback_data' => "/xtlswarp",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
];
|
||||
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||
if (!empty($v['off'])) {
|
||||
@@ -3891,6 +4239,42 @@ DNS-over-HTTPS with IP:
|
||||
);
|
||||
}
|
||||
|
||||
public function routes($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> routes';
|
||||
|
||||
$data = [
|
||||
[[
|
||||
'text' => $this->i18n('block'),
|
||||
'callback_data' => "/xtlsblock",
|
||||
]],
|
||||
[[
|
||||
'text' => $this->i18n('warp'),
|
||||
'callback_data' => "/xtlswarp",
|
||||
]],
|
||||
[[
|
||||
'text' => $this->i18n('package'),
|
||||
'callback_data' => "/xtlsapp",
|
||||
]],
|
||||
[[
|
||||
'text' => $this->i18n('rulesset'),
|
||||
'callback_data' => "/xtlsrulesset",
|
||||
]],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/xray",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function warpPlus()
|
||||
{
|
||||
$r = $this->send(
|
||||
@@ -4149,11 +4533,15 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
|
||||
if (!empty($_GET['r'])) {
|
||||
$si = "$scheme://{$domain}/pac?h=$hash&t=si&s=$uid";
|
||||
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||
'h' => $hash,
|
||||
't' => 'si',
|
||||
's' => $uid,
|
||||
]));
|
||||
$v2 = "$scheme://{$domain}/pac?h=$hash&t=s&s=$uid";
|
||||
switch ($_GET['r']) {
|
||||
case 'si':
|
||||
header("Location: sing-box://import-remote-profile/?url=" . urlencode($si));
|
||||
header("Location: sing-box://import-remote-profile/?url=" . $si);
|
||||
exit;
|
||||
case 'st':
|
||||
header("Location: streisand://import/$v2");
|
||||
@@ -4162,7 +4550,7 @@ DNS-over-HTTPS with IP:
|
||||
header("Location: v2rayng://install-config?url=" . urlencode($v2));
|
||||
exit;
|
||||
case 'h':
|
||||
header("Location: hiddify://install-config/?url=" . urlencode($si));
|
||||
header("Location: hiddify://install-config/?url=" . $si);
|
||||
exit;
|
||||
case 'w':
|
||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||
@@ -4235,7 +4623,10 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
}
|
||||
$c['route']['rules'] = array_values($c['route']['rules']);
|
||||
$c['route'] = $this->addRuleSet($c['route']);
|
||||
$c['route'] = $this->addPackageRule($c['route']);
|
||||
$c['route'] = $this->createRuleSet($c['route'], $uid);
|
||||
$c['route'] = $this->clearEmptyRules($c['route']);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4243,6 +4634,57 @@ DNS-over-HTTPS with IP:
|
||||
echo json_encode($c);
|
||||
}
|
||||
|
||||
public function clearEmptyRules($route)
|
||||
{
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
if (count($v) == 1) {
|
||||
unset($route['rules'][$k]);
|
||||
}
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
public function addPackageRule($route)
|
||||
{
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
$t[$v['outbound']] = $k;
|
||||
}
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($p['packagelist'])) {
|
||||
foreach ($p['packagelist'] as $k => $v) {
|
||||
if (!empty($v)) {
|
||||
$route['rules'][$t['proxy']]['package_name'][] = $k;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
public function addRuleSet($route)
|
||||
{
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
$t[$v['outbound']] = $k;
|
||||
}
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($p['rulessetlist'])) {
|
||||
foreach ($p['rulessetlist'] as $k => $v) {
|
||||
if (!empty($v)) {
|
||||
[$type, $time, $url] = explode(':', $k, 3);
|
||||
$route['rule_set'][] = [
|
||||
"tag" => $k,
|
||||
"type" => "remote",
|
||||
"format" => "binary",
|
||||
"url" => $url,
|
||||
"download_detour" => "direct",
|
||||
"update_interval" => $time
|
||||
];
|
||||
$route['rules'][$t[$type]]['rule_set'][] = $k;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
public function createRuleSet($route, $uid)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -4260,37 +4702,47 @@ DNS-over-HTTPS with IP:
|
||||
unset($r['rules'][$l]);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('domain_suffix', $n) && $n['domain_suffix'] == '~warp~') {
|
||||
$r['rules'][$l]['domain_suffix'] = array_keys(array_filter($pac['warplist'] ?: []));
|
||||
if (empty($r['rules'][$l]['domain_suffix'])) {
|
||||
unset($r['rules'][$l]);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('domain_suffix', $n) && $n['domain_suffix'] == '~block~') {
|
||||
$r['rules'][$l]['domain_suffix'] = array_keys(array_filter($pac['blocklist'] ?: []));
|
||||
if (empty($r['rules'][$l]['domain_suffix'])) {
|
||||
unset($r['rules'][$l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($_GET['r']) && $r['name'] == $_GET['r']) {
|
||||
header("Content-Disposition: attachment; filename={$r['name']}.srs");
|
||||
header('Content-Type: application/binary');
|
||||
$f = "/tmp/{$r['name']}" . time() . rand(1, 100);
|
||||
file_put_contents($f, json_encode([
|
||||
'version' => 1,
|
||||
'rules' => $r['rules'],
|
||||
'rules' => $r['rules'] ?: [],
|
||||
]));
|
||||
exec("sing-box rule-set compile $f");
|
||||
header("Content-Disposition: attachment; filename={$r['name']}.srs");
|
||||
header('Content-Type: application/binary');
|
||||
echo file_get_contents("$f.srs");
|
||||
unlink($f);
|
||||
unlink("$f.srs");
|
||||
exit;
|
||||
}
|
||||
if (!empty($r['rules'])) {
|
||||
$ruleset[] = [
|
||||
"tag" => $r['name'],
|
||||
"url" => "$scheme://{$domain}/pac?" . http_build_query([
|
||||
'h' => $hash,
|
||||
't' => 'si',
|
||||
's' => $uid,
|
||||
'r' => $r['name'],
|
||||
]),
|
||||
"update_interval" => $r['interval'],
|
||||
"type" => "remote",
|
||||
"format" => "binary",
|
||||
"download_detour" => "direct",
|
||||
];
|
||||
$route['rules'][$k]['rule_set'][] = $r['name'];
|
||||
}
|
||||
$ruleset[] = [
|
||||
"tag" => $r['name'],
|
||||
"url" => "$scheme://{$domain}/pac?" . http_build_query([
|
||||
'h' => $hash,
|
||||
't' => 'si',
|
||||
's' => $uid,
|
||||
'r' => $r['name'],
|
||||
]),
|
||||
"update_interval" => $r['interval'],
|
||||
"type" => "remote",
|
||||
"format" => "binary",
|
||||
"download_detour" => "direct",
|
||||
];
|
||||
$route['rules'][$k]['rule_set'][] = $r['name'];
|
||||
}
|
||||
unset($route['rules'][$k]['createruleset']);
|
||||
if (empty($route['rules'][$k]['rule_set'])) {
|
||||
@@ -4700,15 +5152,21 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $this->i18n('export'),
|
||||
'callback_data' => "/export",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('backup') . ': ' . (implode(' / ', explode('/', $conf['backup'])) ?: $this->i18n('off')),
|
||||
'callback_data' => "/backup",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('import'),
|
||||
'callback_data' => "/import",
|
||||
],
|
||||
];
|
||||
$backup = array_filter(explode('/', $conf['backup']));
|
||||
if (!empty($backup)) {
|
||||
$backup = "{$backup[0]} start / {$backup[1]} period";
|
||||
}
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('backup') . ': ' . ($backup ?: $this->i18n('off')),
|
||||
'callback_data' => "/backup",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('logs'),
|
||||
@@ -4844,9 +5302,9 @@ DNS-over-HTTPS with IP:
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter like 1 day/00:00",
|
||||
"@{$this->input['username']} enter like start / period",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter like 1 day/00:00',
|
||||
reply: 'enter like now / 12:00',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
@@ -4911,16 +5369,15 @@ DNS-over-HTTPS with IP:
|
||||
public function setBackup($text)
|
||||
{
|
||||
$text = trim($text);
|
||||
$c = $this->getPacConf();
|
||||
$c = $this->getPacConf();
|
||||
if (empty($text)) {
|
||||
$c['backup'] = '';
|
||||
} elseif (preg_match('~(\d+\s\w+)(?:\s+)?/(?:\s+)?(\d{2}:\d{2})~', $text, $m)) {
|
||||
$period = $m[1];
|
||||
$start = $m[2];
|
||||
$c['backup'] = $text;
|
||||
} else {
|
||||
[$start, $period] = explode('/', $text);
|
||||
$c['backup'] = implode(' / ', [date('Y-m-d H:i', strtotime($start)), trim($period)]);
|
||||
}
|
||||
if ($pin = explode('/', $c['pinbackup'])[0]) {
|
||||
$this->pinAdmin($pin, 1);
|
||||
if ($c['pinbackup']) {
|
||||
$this->pinAdmin($c['pinbackup'], 1);
|
||||
$c['pinbackup'] = '';
|
||||
}
|
||||
$this->setPacConf($c);
|
||||
@@ -5040,6 +5497,9 @@ DNS-over-HTTPS with IP:
|
||||
if (empty($data['interface']['DNS'])) {
|
||||
$data['interface']['DNS'] = $this->getPacConf()[$this->getInstanceWG(1) . 'dns'] ?: $this->dns;
|
||||
}
|
||||
if (empty($data['interface']['MTU'])) {
|
||||
$data['interface']['MTU'] = $this->getPacConf()[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu;
|
||||
}
|
||||
}
|
||||
foreach ($data['interface'] as $k => $v) {
|
||||
$conf[] = "$k = $v";
|
||||
@@ -5129,7 +5589,6 @@ DNS-over-HTTPS with IP:
|
||||
'## name' => $name,
|
||||
'PrivateKey' => $private_peer_key,
|
||||
'Address' => "$client_ip/32",
|
||||
'MTU' => 1350,
|
||||
],
|
||||
$this->getPacConf()[$this->getInstanceWG(1) . 'amnezia'] ? $this->amneziaKeys() : []
|
||||
),
|
||||
|
||||
+6
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
$i = [
|
||||
'warp' => [
|
||||
'en' => 'Warp',
|
||||
'ru' => 'Warp',
|
||||
'en' => 'warp',
|
||||
'ru' => 'warp',
|
||||
],
|
||||
'wg_title' => [
|
||||
'en' => 'Wireguard',
|
||||
@@ -241,6 +241,10 @@ $i = [
|
||||
'en' => 'defaultDNS',
|
||||
'ru' => 'дефолтный днс',
|
||||
],
|
||||
'defaultMTU' => [
|
||||
'en' => 'defaultMTU',
|
||||
'ru' => 'дефолтный MTU',
|
||||
],
|
||||
'debug' => [
|
||||
'en' => 'debug mode',
|
||||
'ru' => 'режим отладки',
|
||||
|
||||
+6
-3
@@ -17,10 +17,13 @@ if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $c['key']) {
|
||||
}
|
||||
|
||||
// pac
|
||||
$type = $_GET['t'] ?? 'pac';
|
||||
if (!empty($t = unserialize(base64_decode(explode('/', $_SERVER['REQUEST_URI'])[2])))) { // fix sing-box import
|
||||
$_GET = array_merge($_GET, $t);
|
||||
}
|
||||
$type = $_GET['t'] ?? 'pac';
|
||||
$address = $_GET['a'] ?: '127.0.0.1';
|
||||
$port = $_GET['p'] ?: '1080';
|
||||
$hash = $_GET['h'];
|
||||
$port = $_GET['p'] ?: '1080';
|
||||
$hash = $_GET['h'];
|
||||
if ($hash == substr(md5($c['key']), 0, 8)) {
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/i18n.php';
|
||||
|
||||
+12
-6
@@ -89,11 +89,14 @@ function start()
|
||||
|
||||
$conf = $bot->getPacConf();
|
||||
|
||||
$subzones = array_keys(array_filter($conf['subzoneslist'], fn($x) => $x == true));
|
||||
if (!empty($conf['subzoneslist'])) {
|
||||
$subzones = array_keys(array_filter($conf['subzoneslist'], fn($x) => $x == true));
|
||||
}
|
||||
|
||||
// check && exclude
|
||||
$include = array_filter($conf['includelist'], fn($x) => $x == true);
|
||||
$domains = $include;
|
||||
if (!empty($conf['includelist'])) {
|
||||
$domains = array_filter($conf['includelist'], fn($x) => $x == true);
|
||||
}
|
||||
if (empty($domains)) {
|
||||
$text = "Empty domains. Delete pac files";
|
||||
unlink(__DIR__ . '/zapretlists/mpac');
|
||||
@@ -146,10 +149,13 @@ function start()
|
||||
file_put_contents(__DIR__ . '/zapretlists/pac', $pac);
|
||||
$text .= "Create minified pac 100%\n";
|
||||
}
|
||||
|
||||
// create reverse PAC
|
||||
$domains = array_filter($conf['reverselist'], fn($x) => $x == true);
|
||||
unset($domains);
|
||||
if (!empty($conf['reverselist'])) {
|
||||
$domains = array_filter($conf['reverselist'], fn($x) => $x == true);
|
||||
}
|
||||
if (empty($domains)) {
|
||||
|
||||
// $text .= "Empty reverse domains. Delete reverse pac files";
|
||||
unlink(__DIR__ . '/zapretlists/rmpac');
|
||||
unlink(__DIR__ . '/zapretlists/rpac');
|
||||
@@ -197,6 +203,7 @@ function start()
|
||||
file_put_contents(__DIR__ . '/zapretlists/rpac', $pac);
|
||||
$text .= 'Create minified reverse pac 100%';
|
||||
}
|
||||
|
||||
endScript($text);
|
||||
}
|
||||
|
||||
@@ -242,7 +249,6 @@ $load = [
|
||||
'-',
|
||||
'\\',
|
||||
];
|
||||
|
||||
switch ($_SERVER['argv'][1]) {
|
||||
case 'start':
|
||||
$bot = new Bot($c['key'], $i);
|
||||
|
||||
+27
-1
@@ -113,16 +113,42 @@
|
||||
{
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "selfpac",
|
||||
"name": "pac",
|
||||
"interval": "15s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~pac~"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "warp",
|
||||
"interval": "15s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~warp~"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outbound": "proxy"
|
||||
},
|
||||
{
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "block",
|
||||
"interval": "15s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~block~"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outbound": "block"
|
||||
},
|
||||
{
|
||||
"outbound": "direct"
|
||||
}
|
||||
],
|
||||
"final": "direct"
|
||||
|
||||
+11
-8
@@ -19,7 +19,7 @@ volumes:
|
||||
|
||||
services:
|
||||
up:
|
||||
image: mercurykd/vpnbot-up:1.1
|
||||
image: mercurykd/vpnbot-ng:1.1
|
||||
build:
|
||||
context: dockerfile
|
||||
dockerfile: nginx.dockerfile
|
||||
@@ -191,7 +191,7 @@ services:
|
||||
- oc
|
||||
- np
|
||||
proxy:
|
||||
image: mercurykd/vpnbot-ss:1.1
|
||||
image: mercurykd/vpnbot-ss:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
args:
|
||||
@@ -338,7 +338,7 @@ services:
|
||||
entrypoint: ["/bin/sh", "/start_ad.sh"]
|
||||
logging: *default-logging
|
||||
ss:
|
||||
image: mercurykd/vpnbot-ss:1.1
|
||||
image: mercurykd/vpnbot-ss:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
args:
|
||||
@@ -399,7 +399,7 @@ services:
|
||||
ipv4_address: 10.10.0.8
|
||||
logging: *default-logging
|
||||
xr:
|
||||
image: mercurykd/vpnbot-xr:1.2
|
||||
image: mercurykd/vpnbot-xr:1.3
|
||||
build:
|
||||
dockerfile: dockerfile/xray.dockerfile
|
||||
args:
|
||||
@@ -493,7 +493,7 @@ services:
|
||||
ipv4_address: 10.10.0.12
|
||||
logging: *default-logging
|
||||
wp:
|
||||
image: mercurykd/vpnbot-wp:1.1
|
||||
image: mercurykd/vpnbot-wp:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/warp.dockerfile
|
||||
args:
|
||||
@@ -503,7 +503,7 @@ services:
|
||||
devices:
|
||||
- /dev/net/tun:/dev/net/tun
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/.profile:/root/.ashrc:ro
|
||||
- ./ssh:/ssh
|
||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||
- ./config:/config
|
||||
@@ -514,8 +514,11 @@ services:
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
env_file:
|
||||
- path: ./.env
|
||||
required: true # default
|
||||
- path: ./override.env
|
||||
required: false
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_wp.sh"]
|
||||
networks:
|
||||
|
||||
@@ -2,16 +2,16 @@ ARG image
|
||||
FROM $image
|
||||
RUN apk add openssh git xz \
|
||||
&& mkdir /root/.ssh \
|
||||
&& wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.15.3/shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& tar -xf shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& wget https://github.com/teddysun/v2ray-plugin/releases/download/v5.7.0/v2ray-plugin-linux-amd64-v5.7.0.tar.gz \
|
||||
&& tar -xf v2ray-plugin-linux-amd64-v5.7.0.tar.gz \
|
||||
&& wget -O shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz $(wget -q -O - https://api.github.com/repos/shadowsocks/shadowsocks-rust/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep '.x86_64-unknown-linux-musl.tar.xz$') \
|
||||
&& tar -xf shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& wget -O v2ray-plugin-linux-amd64.tar.gz $(wget -q -O - https://api.github.com/repos/teddysun/v2ray-plugin/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'v2ray-plugin-linux-amd64') \
|
||||
&& tar -xf v2ray-plugin-linux-amd64.tar.gz \
|
||||
&& mv sslocal /usr/bin/ \
|
||||
&& mv ssserver /usr/bin/ \
|
||||
&& mv ssmanager /usr/bin/ \
|
||||
&& mv ssservice /usr/bin/ \
|
||||
&& mv ssurl /usr/bin/ \
|
||||
&& mv v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin \
|
||||
&& rm v2ray-plugin-linux-amd64-v5.7.0.tar.gz\
|
||||
&& rm shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz
|
||||
&& rm v2ray-plugin-linux-amd64.tar.gz \
|
||||
&& rm shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz
|
||||
ENV ENV="/root/.ashrc"
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
FROM ubuntu:22.04
|
||||
RUN apt update && apt install -y curl gpg socat jq lsb-release openssh-server \
|
||||
FROM ubuntu:22.04 AS build
|
||||
RUN apt update && apt install -y curl gpg lsb-release \
|
||||
&& 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 \
|
||||
&& 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
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
ARG image
|
||||
FROM $image
|
||||
RUN apk add --no-cache --virtual .build-deps alpine-sdk git go \
|
||||
COPY --from=golang:1.22.3-alpine /usr/local/go/ /usr/local/go/
|
||||
ENV PATH="/usr/local/go/bin:${PATH}"
|
||||
RUN apk add --no-cache --virtual .build-deps alpine-sdk git \
|
||||
&& apk add iproute2 linux-headers iptables xtables-addons openssh wireguard-tools jq bash htop \
|
||||
&& git clone https://github.com/amnezia-vpn/amneziawg-go \
|
||||
&& git clone https://github.com/amnezia-vpn/amneziawg-tools.git \
|
||||
|
||||
@@ -2,7 +2,7 @@ ARG image
|
||||
FROM $image
|
||||
RUN apk add openssh openssl jq \
|
||||
&& mkdir /root/.ssh \
|
||||
&& wget https://github.com/XTLS/Xray-core/releases/download/v1.8.10/Xray-linux-64.zip \
|
||||
&& wget -O Xray-linux-64.zip $(wget -q -O - https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'Xray-linux-64.zip$') \
|
||||
&& unzip Xray-linux-64.zip \
|
||||
&& mv xray /usr/bin/ \
|
||||
&& rm Xray-linux-64.zip \
|
||||
|
||||
@@ -31,7 +31,7 @@ up: # консоль сервиса
|
||||
ad: # консоль сервиса
|
||||
docker compose exec ad /bin/sh
|
||||
wp: # консоль сервиса
|
||||
docker compose exec wp bash
|
||||
docker compose exec wp /bin/sh
|
||||
proxy: # консоль сервиса
|
||||
docker compose exec proxy /bin/sh
|
||||
tg: # консоль сервиса
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+2
-3
@@ -1,7 +1,6 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
|
||||
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
|
||||
service ssh start
|
||||
ssh-keygen -A
|
||||
exec /usr/sbin/sshd -D -e "$@" &
|
||||
warp-svc > /dev/null &
|
||||
sleep 3
|
||||
warp-cli --accept-tos registration new
|
||||
|
||||
Regular → Executable
Regular → Executable
@@ -1,3 +1,23 @@
|
||||
16.08.2024 v1.42
|
||||
- добавлена возможность сохранять/восстанавливать список доменов/правил маршрутизации
|
||||
- изменена ссылка на сингбокс-конфиг для совместимости с клиентом сингбокса (фикс импорта в sing-box)
|
||||
- sing-box: добавлена возможность добавлять свои packagename (outbound:proxy)
|
||||
- sing-box: добавлена возможность добавлять свои ruleset с указанием outbound и временем обновления
|
||||
- sing-box: списки доменов pac/warp/block трансформируются в собственный ruleset и присутствуют в шаблоне origin всегда, даже если они пустые. это дает возможность не ждать перезагрузки конфига клиентом
|
||||
09.08.2024 v1.41.1
|
||||
- фикс для "удалить все" в списках доменов
|
||||
06.08.2024 v1.41
|
||||
- возможность очистить РАС лист
|
||||
03.08.2024 v1.40
|
||||
- возможность менять MTU для Wireguard/Amnezia
|
||||
- раздельный qr для AmneziaWG + AmneziaVPN
|
||||
18.05.2024 v1.39
|
||||
- изменен автобэкап
|
||||
04.05.2024 v1.38
|
||||
- changelog в сообщении новой версии
|
||||
04.05.2024 v1.37.1
|
||||
- warp на образе alpine (thx @zmeyzloy)
|
||||
- фикс выбора шаблона singbox
|
||||
22.04.2024 v1.35
|
||||
- очистка старых образов
|
||||
19.04.2024 v1.34
|
||||
|
||||
Reference in New Issue
Block a user