Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 4fb039ffc4 | |||
| 0b7ae110fc | |||
| c0750c930a | |||
| 6fb1931c2d | |||
| 45e1455d48 | |||
| 7582dc50c2 | |||
| bb1ac60acc | |||
| 256e43352a | |||
| 6a31985863 | |||
| f4a9e63793 | |||
| 581e3a9bd1 | |||
| 8491ee9f51 | |||
| 49cefc3231 | |||
| b227431b7a | |||
| bb83ab0684 | |||
| 05267f44be | |||
| d1be532270 | |||
| 48798c7e61 | |||
| 84e71ab45b |
+419
-64
@@ -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,12 @@ 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('~^/deleteYes (\w+)$~', $this->input['callback'], $m):
|
||||
$this->deleteYes($m[1]);
|
||||
break;
|
||||
case preg_match('~^/addCommunityFilter$~', $this->input['callback'], $m):
|
||||
$this->addCommunityFilter();
|
||||
break;
|
||||
@@ -184,6 +196,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 +214,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;
|
||||
@@ -368,6 +386,12 @@ class Bot
|
||||
case preg_match('~^/domain$~', $this->input['callback'], $m):
|
||||
$this->domain();
|
||||
break;
|
||||
case preg_match('~^/warp$~', $this->input['callback'], $m):
|
||||
$this->warp();
|
||||
break;
|
||||
case preg_match('~^/warpPlus$~', $this->input['callback'], $m):
|
||||
$this->warpPlus();
|
||||
break;
|
||||
case preg_match('~^/xray(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xray($m[1] ?: 0);
|
||||
break;
|
||||
@@ -455,9 +479,9 @@ class Bot
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter url",
|
||||
"@{$this->input['username']} enter key or 0 for stop mtproto",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter url',
|
||||
reply: 'enter key or 0 for stop mtproto',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
@@ -512,10 +536,7 @@ class Bot
|
||||
|
||||
public function mtproto()
|
||||
{
|
||||
$s = file_get_contents('/config/mtprotosecret');
|
||||
$d = file_get_contents('/config/mtprotodomain') ?: 'vk.com';
|
||||
$p = getenv('TGPORT');
|
||||
$ip = $this->getPacConf()['domain'] ?: $this->ip;
|
||||
$st = $this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off';
|
||||
$text[] = "Menu -> MTProto\n";
|
||||
$text[] = "status: $st\n";
|
||||
@@ -945,22 +966,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();
|
||||
}
|
||||
}
|
||||
@@ -981,10 +996,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()
|
||||
@@ -1002,7 +1017,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"],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1469,21 +1491,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']);
|
||||
$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),
|
||||
$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'];
|
||||
@@ -2428,6 +2459,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 = [
|
||||
[
|
||||
@@ -2455,6 +2487,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",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
@@ -2542,6 +2578,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();
|
||||
@@ -2554,6 +2622,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(
|
||||
@@ -2872,6 +2964,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'),
|
||||
@@ -3050,6 +3148,80 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAll($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'includelist':
|
||||
$dir = 'PAC';
|
||||
break;
|
||||
case 'warplist':
|
||||
$dir = 'WARP';
|
||||
break;
|
||||
case 'blocklist':
|
||||
$dir = 'BLOCK';
|
||||
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;
|
||||
}
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
$text,
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function xtlsblock($page = 0)
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> block list';
|
||||
@@ -3127,6 +3299,12 @@ DNS-over-HTTPS with IP:
|
||||
]
|
||||
];
|
||||
}
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('delete all'),
|
||||
'callback_data' => "/deleteAll $type",
|
||||
],
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@@ -3278,8 +3456,8 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/menu ss",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('mirror'),
|
||||
'callback_data' => "/menu mirror",
|
||||
'text' => $this->i18n('warp') . ': ' . $this->warpStatus(),
|
||||
'callback_data' => "/warp",
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -3363,6 +3541,49 @@ DNS-over-HTTPS with IP:
|
||||
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?security=reality&sni={$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}&fp=chrome&pbk={$pac['xray']}&sid={$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}&type=tcp&flow=xtls-rprx-vision#vpnbot";
|
||||
}
|
||||
|
||||
public function dockerApi($url, $method = 'GET', $data = [])
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_CUSTOMREQUEST => $method,
|
||||
CURLOPT_POSTFIELDS => !empty($data) ? json_encode($data) : null,
|
||||
CURLOPT_URL => "http://localhost$url",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_UNIX_SOCKET_PATH => '/var/run/docker.sock'
|
||||
]);
|
||||
$r = json_decode(curl_exec($ch), true);
|
||||
curl_close($ch);
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function cleanDocker()
|
||||
{
|
||||
$r = $this->dockerApi('/images/json');
|
||||
foreach ($r as $v) {
|
||||
if (!empty($v['RepoTags'])) {
|
||||
foreach ($v['RepoTags'] as $j) {
|
||||
if (preg_match('~^mercurykd/vpnbot~', $j)) {
|
||||
$i[] = $v['Id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$r = $this->dockerApi('/containers/json?all=1');
|
||||
foreach ($r as $v) {
|
||||
if (preg_match('~^mercurykd/vpnbot~', $v['Image'])) {
|
||||
$c[] = $v['ImageID'];
|
||||
}
|
||||
}
|
||||
if (!empty($d = array_diff($i, $c))) {
|
||||
foreach ($d as $v) {
|
||||
$this->dockerApi("/images/$v", 'DELETE');
|
||||
}
|
||||
}
|
||||
$this->dockerApi('/images/prune', 'POST', ['dangling' => true]);
|
||||
$this->dockerApi('/build/prune', 'POST');
|
||||
}
|
||||
|
||||
public function naiveMenu()
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -3463,12 +3684,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'),
|
||||
@@ -3696,7 +3918,7 @@ DNS-over-HTTPS with IP:
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($pac["default{$type}template"] ? 'off' : 'on'),
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||
'callback_data' => "/defaultTemplate $type",
|
||||
],
|
||||
];
|
||||
@@ -3840,6 +4062,64 @@ DNS-over-HTTPS with IP:
|
||||
);
|
||||
}
|
||||
|
||||
public function warpPlus()
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter key",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter key',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'addWarpPlus',
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function addWarpPlus($key)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$c['warp'] = $key;
|
||||
$this->setPacConf($c);
|
||||
$this->send($this->input['chat'], 'Warp registration license: ' . $this->ssh("warp-cli --accept-tos registration license $key", 'wp'));
|
||||
sleep(1);
|
||||
$this->warp();
|
||||
}
|
||||
|
||||
public function warpStatus()
|
||||
{
|
||||
$st = $this->ssh('curl -m 1 -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp');
|
||||
preg_match('~warp=(\w+)~', $st, $m);
|
||||
return $m[1];
|
||||
}
|
||||
|
||||
public function warp()
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('warp');
|
||||
$text[] = "status: " . $this->warpStatus();
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('set key'),
|
||||
'callback_data' => "/warpPlus",
|
||||
],
|
||||
];
|
||||
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/menu",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function choiceTemplate($arg)
|
||||
{
|
||||
$arg = explode('_', $arg);
|
||||
@@ -3905,10 +4185,10 @@ DNS-over-HTTPS with IP:
|
||||
$text[] = "<code>{$this->linkXray($i)}</code>\n";
|
||||
|
||||
$text[] = "import subscribe:";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=v&s={$c['id']}'>v2rayng</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=si&s={$c['id']}'>sing-box</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=st&s={$c['id']}'>streisand</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=h&s={$c['id']}'>hiddify</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=v&s={$c['id']}#{$c['email']}'>v2rayng</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=si&s={$c['id']}#{$c['email']}'>sing-box</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=st&s={$c['id']}#{$c['email']}'>streisand</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=h&s={$c['id']}#{$c['email']}'>hiddify</a>";
|
||||
|
||||
$text[] = "\nv2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code>";
|
||||
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code>";
|
||||
@@ -3934,8 +4214,8 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/switchXr $i",
|
||||
],
|
||||
];
|
||||
$singtemplate = $c['singtemplate'] ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
|
||||
$v2raytemplate = $c['v2raytemplate'] ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
|
||||
$singtemplate = $c['singtemplate'] ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] && !empty($pac['singtemplates'][base64_decode($pac['defaultsingtemplate'])]) ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
|
||||
$v2raytemplate = $c['v2raytemplate'] ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] && !empty($pac['v2raytemplates'][base64_decode($pac['defaultv2raytemplate'])]) ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('v2ray') . ": $v2raytemplate",
|
||||
@@ -4017,6 +4297,7 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function subscription()
|
||||
{
|
||||
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $pac['domain'] ?: $this->ip;
|
||||
$xr = $this->getXray();
|
||||
@@ -4029,7 +4310,7 @@ DNS-over-HTTPS with IP:
|
||||
if (empty($v['off'])) {
|
||||
$flag = false;
|
||||
}
|
||||
$template = base64_decode($_GET['t'] == 's' ? $v['v2raytemplate'] : $v['singtemplate']);
|
||||
$template = base64_decode($v["{$type}template"]);
|
||||
$uid = $v['id'];
|
||||
break;
|
||||
}
|
||||
@@ -4055,7 +4336,8 @@ DNS-over-HTTPS with IP:
|
||||
header("Location: hiddify://install-config/?url=" . urlencode($si));
|
||||
exit;
|
||||
case 'w':
|
||||
file_put_contents('/singbox/update.cmd', preg_replace('#~url~#', $si, file_get_contents('/singbox/update.cmd')));
|
||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||
file_put_contents('/singbox/winsw3.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw3.xml')));
|
||||
$zip = new ZipArchive();
|
||||
$n = "singbox_$uid.zip";
|
||||
$zip->open($n, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||
@@ -4071,18 +4353,19 @@ DNS-over-HTTPS with IP:
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case !empty($template) && $template == 'origin':
|
||||
case empty($template) && empty($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']):
|
||||
$c = json_decode(file_get_contents('/config/' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . '.json'), true);
|
||||
case empty($template) && empty($pac["default{$type}template"]):
|
||||
case empty($template) && empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]):
|
||||
case !empty($template) && empty($pac["{$type}templates"][$template]):
|
||||
$c = json_decode(file_get_contents("/config/{$type}.json"), true);
|
||||
break;
|
||||
case !empty($template):
|
||||
$c = $pac[$_GET['t'] == 's' ? 'v2raytemplates' : 'singtemplates'][$template];
|
||||
$c = $pac["{$type}templates"][$template];
|
||||
break;
|
||||
|
||||
default:
|
||||
$c = $pac[$_GET['t'] == 's' ? 'v2raytemplates' : 'singtemplates'][base64_decode($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template'])];
|
||||
$c = $pac["{$type}templates"][base64_decode($pac["default{$type}template"])];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4123,6 +4406,7 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
}
|
||||
$c['route']['rules'] = array_values($c['route']['rules']);
|
||||
$c['route'] = $this->createRuleSet($c['route'], $uid);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4130,6 +4414,69 @@ DNS-over-HTTPS with IP:
|
||||
echo json_encode($c);
|
||||
}
|
||||
|
||||
public function createRuleSet($route, $uid)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $pac['domain'] ?: $this->ip;
|
||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||
$hash = substr(md5($this->key), 0, 8);
|
||||
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
if (!empty($v['createruleset'])) {
|
||||
foreach ($v['createruleset'] as $i => $r) {
|
||||
foreach ($r['rules'] as $l => $n) {
|
||||
if (array_key_exists('domain_suffix', $n) && $n['domain_suffix'] == '~pac~') {
|
||||
$r['rules'][$l]['domain_suffix'] = array_keys(array_filter($pac['includelist'] ?: []));
|
||||
if (empty($r['rules'][$l]['domain_suffix'])) {
|
||||
unset($r['rules'][$l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($_GET['r']) && $r['name'] == $_GET['r']) {
|
||||
$f = "/tmp/{$r['name']}" . time() . rand(1, 100);
|
||||
file_put_contents($f, json_encode([
|
||||
'version' => 1,
|
||||
'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'];
|
||||
}
|
||||
}
|
||||
unset($route['rules'][$k]['createruleset']);
|
||||
if (empty($route['rules'][$k]['rule_set'])) {
|
||||
unset($route['rules'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$route['rules'] = array_values($route['rules']);
|
||||
$route['rule_set'] = array_merge($route['rule_set'] ?: [], $ruleset ?: []);
|
||||
if (empty($route['rule_set'])) {
|
||||
unset($route['rule_set']);
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
public function getXray()
|
||||
{
|
||||
return json_decode(file_get_contents('/config/xray.json'), true);
|
||||
@@ -4524,15 +4871,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'),
|
||||
@@ -4668,9 +5021,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'],
|
||||
@@ -4735,16 +5088,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);
|
||||
@@ -4864,6 +5216,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";
|
||||
@@ -4953,7 +5308,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() : []
|
||||
),
|
||||
@@ -5062,8 +5416,9 @@ DNS-over-HTTPS with IP:
|
||||
fclose($s);
|
||||
ssh2_disconnect($c);
|
||||
} catch (Exception | Error $e) {
|
||||
$this->send($this->input['chat'], $e->getMessage(), $this->input['message_id']);
|
||||
die();
|
||||
if (!empty($GLOBALS['debug'])) {
|
||||
$this->send($this->input['chat'], $e->getMessage(), $this->input['message_id']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
$i = [
|
||||
'warp' => [
|
||||
'en' => 'Warp',
|
||||
'ru' => 'Warp',
|
||||
],
|
||||
'wg_title' => [
|
||||
'en' => 'Wireguard',
|
||||
'ru' => 'Wireguard',
|
||||
@@ -237,6 +241,10 @@ $i = [
|
||||
'en' => 'defaultDNS',
|
||||
'ru' => 'дефолтный днс',
|
||||
],
|
||||
'defaultMTU' => [
|
||||
'en' => 'defaultMTU',
|
||||
'ru' => 'дефолтный MTU',
|
||||
],
|
||||
'debug' => [
|
||||
'en' => 'debug mode',
|
||||
'ru' => 'режим отладки',
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ if ($hash == substr(md5($c['key']), 0, 8)) {
|
||||
|
||||
case 'te':
|
||||
if (!empty($_GET['te'])) {
|
||||
$t = $bot->getPacConf()["{$_GET['ty']}templates"][urldecode($_GET['te'])];
|
||||
$t = $bot->getPacConf()["{$_GET['ty']}templates"][$_GET['te']];
|
||||
} else {
|
||||
$t = json_decode(file_get_contents("/config/{$_GET['ty']}.json"), true);
|
||||
}
|
||||
|
||||
+3
-1
@@ -2,10 +2,12 @@
|
||||
|
||||
require __DIR__ . '/timezone.php';
|
||||
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/i18n.php';
|
||||
if ($c['debug']) {
|
||||
require __DIR__ . '/debug.php';
|
||||
}
|
||||
|
||||
$bot = new Bot($c['key'], $i);
|
||||
$bot->adguardProtect();
|
||||
|
||||
+5
-1
@@ -2,11 +2,14 @@
|
||||
|
||||
require __DIR__ . '/timezone.php';
|
||||
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/i18n.php';
|
||||
|
||||
if ($c['debug']) {
|
||||
require __DIR__ . '/debug.php';
|
||||
}
|
||||
|
||||
$bot = new Bot($c['key'], $i);
|
||||
|
||||
if (!empty($c['admin'])) {
|
||||
@@ -37,3 +40,4 @@ file_put_contents('/update/message', '');
|
||||
file_put_contents('/update/reload_message', '');
|
||||
$bot->restartTG();
|
||||
$bot->sslip();
|
||||
$bot->cleanDocker();
|
||||
|
||||
+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);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div style="position:absolute;top:0;right:0;width:35%;text-align:center;background-color: #17212b;">
|
||||
<img src="toncoin.png" width="100%" alt="">
|
||||
<a href="javascript:;" id="copy" style="color:white;text-decoration:none" data-id="UQCDDkaX3fCAFBek28Hx4TfvDDRqeizOW74blVMVAM4_m4OW">copy</a>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=mercurykd&repo=vpnbot&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
|
||||
<!-- <iframe src="https://ghbtns.com/github-btn.html?user=mercurykd&repo=vpnbot&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe> -->
|
||||
</div>
|
||||
<a style="background-color: #8B3FFD;height: 46px;display:inline-block;padding:0 54px;color: white;border-radius: 12px;text-decoration: none;font-size: 20px;line-height: 46px;font-family: arial;" href="https://yoomoney.ru/to/410011827900450">
|
||||
<svg style="width: 24px;fill: white;position: relative;top: 4px;" class="qa-fundraise-button-logo mui-m0okdh" viewBox="0 0 16 16"><path d="M4.638 8.5a5.67 5.67 0 015.681-5.68A5.693 5.693 0 0116 8.5a5.693 5.693 0 01-5.68 5.682A5.67 5.67 0 014.637 8.5zm3.56 0c0 1.151.97 2.122 2.121 2.122 1.15 0 2.085-.97 2.121-2.121 0-1.15-.97-2.121-2.12-2.121-1.151 0-2.122.97-2.122 2.12zm-3.596 4.243v-8.27H0l2.589 8.27h2.013z" clip-rule="evenodd"></path></svg>
|
||||
|
||||
+111
-87
@@ -3,104 +3,128 @@
|
||||
"level": "error",
|
||||
"timestamp": true
|
||||
},
|
||||
"inbounds": [{
|
||||
"type": "tun",
|
||||
"tag": "tun-in",
|
||||
"domain_strategy": "prefer_ipv4",
|
||||
"interface_name": "sing-tun",
|
||||
"inet4_address": "172.19.0.1\/30",
|
||||
"mtu": 1400,
|
||||
"gso": true,
|
||||
"auto_route": true,
|
||||
"strict_route": true,
|
||||
"sniff": true,
|
||||
"endpoint_independent_nat": false,
|
||||
"stack": "mixed",
|
||||
"platform": {
|
||||
"http_proxy": {
|
||||
"enabled": false,
|
||||
"server": "127.0.0.1",
|
||||
"server_port": 2080
|
||||
"inbounds": [
|
||||
{
|
||||
"type": "tun",
|
||||
"tag": "tun-in",
|
||||
"domain_strategy": "prefer_ipv4",
|
||||
"interface_name": "sing-tun",
|
||||
"inet4_address": "172.19.0.1\/30",
|
||||
"mtu": 1400,
|
||||
"gso": true,
|
||||
"auto_route": true,
|
||||
"strict_route": true,
|
||||
"sniff": true,
|
||||
"endpoint_independent_nat": false,
|
||||
"stack": "mixed",
|
||||
"platform": {
|
||||
"http_proxy": {
|
||||
"enabled": false,
|
||||
"server": "127.0.0.1",
|
||||
"server_port": 2080
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "mixed",
|
||||
"tag": "mixed-in",
|
||||
"domain_strategy": "prefer_ipv4",
|
||||
"listen": "127.0.0.1",
|
||||
"listen_port": 2080,
|
||||
"tcp_fast_open": true,
|
||||
"sniff": true,
|
||||
"sniff_override_destination": false,
|
||||
"users": []
|
||||
}
|
||||
}, {
|
||||
"type": "mixed",
|
||||
"tag": "mixed-in",
|
||||
"domain_strategy": "prefer_ipv4",
|
||||
"listen": "127.0.0.1",
|
||||
"listen_port": 2080,
|
||||
"tcp_fast_open": true,
|
||||
"sniff": true,
|
||||
"sniff_override_destination": false,
|
||||
"users": []
|
||||
}],
|
||||
],
|
||||
"dns": {
|
||||
"servers": [{
|
||||
"tag": "dns_direct",
|
||||
"address": "~dns~",
|
||||
"address_resolver": "dns-remote",
|
||||
"strategy": "prefer_ipv4",
|
||||
"detour": "direct"
|
||||
}, {
|
||||
"tag": "dns-remote",
|
||||
"address": "tcp:\/\/8.8.8.8",
|
||||
"address_strategy": "prefer_ipv4",
|
||||
"strategy": "prefer_ipv4",
|
||||
"detour": "direct"
|
||||
}],
|
||||
"rules": [{
|
||||
"outbound": "any",
|
||||
"server": "dns-direct",
|
||||
"disable_cache": false
|
||||
}],
|
||||
"servers": [
|
||||
{
|
||||
"tag": "dns_direct",
|
||||
"address": "~dns~",
|
||||
"address_resolver": "dns-remote",
|
||||
"strategy": "prefer_ipv4",
|
||||
"detour": "direct"
|
||||
},
|
||||
{
|
||||
"tag": "dns-remote",
|
||||
"address": "tcp:\/\/8.8.8.8",
|
||||
"address_strategy": "prefer_ipv4",
|
||||
"strategy": "prefer_ipv4",
|
||||
"detour": "direct"
|
||||
}
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"outbound": "any",
|
||||
"server": "dns-direct",
|
||||
"disable_cache": false
|
||||
}
|
||||
],
|
||||
"strategy": "ipv4_only",
|
||||
"independent_cache": true
|
||||
},
|
||||
"outbounds": [{
|
||||
"flow": "xtls-rprx-vision",
|
||||
"packet_encoding": "",
|
||||
"server": "",
|
||||
"server_port": 443,
|
||||
"tls": {
|
||||
"enabled": true,
|
||||
"insecure": false,
|
||||
"reality": {
|
||||
"outbounds": [
|
||||
{
|
||||
"flow": "xtls-rprx-vision",
|
||||
"packet_encoding": "",
|
||||
"server": "",
|
||||
"server_port": 443,
|
||||
"tls": {
|
||||
"enabled": true,
|
||||
"public_key": "",
|
||||
"short_id": ""
|
||||
"insecure": false,
|
||||
"reality": {
|
||||
"enabled": true,
|
||||
"public_key": "",
|
||||
"short_id": ""
|
||||
},
|
||||
"server_name": "",
|
||||
"utls": {
|
||||
"enabled": true,
|
||||
"fingerprint": "chrome"
|
||||
}
|
||||
},
|
||||
"server_name": "",
|
||||
"utls": {
|
||||
"enabled": true,
|
||||
"fingerprint": "chrome"
|
||||
}
|
||||
"uuid": "",
|
||||
"type": "vless",
|
||||
"domain_strategy": "ipv4_only",
|
||||
"tag": "proxy"
|
||||
},
|
||||
"uuid": "",
|
||||
"type": "vless",
|
||||
"domain_strategy": "ipv4_only",
|
||||
"tag": "proxy"
|
||||
}, {
|
||||
"type": "direct",
|
||||
"tag": "direct"
|
||||
}, {
|
||||
"type": "block",
|
||||
"tag": "block"
|
||||
}, {
|
||||
"type": "dns",
|
||||
"tag": "dns-out"
|
||||
}],
|
||||
{
|
||||
"type": "direct",
|
||||
"tag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "block",
|
||||
"tag": "block"
|
||||
},
|
||||
{
|
||||
"type": "dns",
|
||||
"tag": "dns-out"
|
||||
}
|
||||
],
|
||||
"route": {
|
||||
"auto_detect_interface": true,
|
||||
"override_android_vpn": true,
|
||||
"rules": [{
|
||||
"protocol": "dns",
|
||||
"outbound": "dns-out"
|
||||
}, {
|
||||
"domain_suffix": "~pac~",
|
||||
"outbound": "proxy"
|
||||
}, {
|
||||
"ip_cidr": ["0.0.0.0\/0"],
|
||||
"outbound": "direct"
|
||||
}]
|
||||
"rules": [
|
||||
{
|
||||
"protocol": "dns",
|
||||
"outbound": "dns-out"
|
||||
},
|
||||
{
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "selfpac",
|
||||
"interval": "15s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~pac~"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outbound": "proxy"
|
||||
}
|
||||
],
|
||||
"final": "direct"
|
||||
}
|
||||
}
|
||||
+15
-10
@@ -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
|
||||
@@ -93,7 +93,7 @@ services:
|
||||
ipv4_address: 10.10.1.2
|
||||
logging: *default-logging
|
||||
php:
|
||||
image: mercurykd/vpnbot-php:1.4
|
||||
image: mercurykd/vpnbot-php:1.5
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -116,6 +116,7 @@ services:
|
||||
- ./update:/update
|
||||
- ./.git:/.git
|
||||
- ./singbox_windows:/singbox
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
environment:
|
||||
IP: ${IP}
|
||||
VER: ${VER}
|
||||
@@ -142,7 +143,7 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
service:
|
||||
image: mercurykd/vpnbot-php:1.2
|
||||
image: mercurykd/vpnbot-php:1.5
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -157,6 +158,7 @@ services:
|
||||
- ./logs/:/logs/
|
||||
- ./update:/update
|
||||
- ./scripts/start_service.sh:/start_service.sh
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
environment:
|
||||
IP: ${IP}
|
||||
VER: ${VER}
|
||||
@@ -189,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:
|
||||
@@ -336,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:
|
||||
@@ -397,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:
|
||||
@@ -491,7 +493,7 @@ services:
|
||||
ipv4_address: 10.10.0.12
|
||||
logging: *default-logging
|
||||
wp:
|
||||
image: mercurykd/vpnbot-wp:1
|
||||
image: mercurykd/vpnbot-wp:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/warp.dockerfile
|
||||
args:
|
||||
@@ -501,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
|
||||
@@ -512,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:
|
||||
|
||||
@@ -26,5 +26,10 @@ RUN apk add --no-cache --update php81 \
|
||||
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& mv linux-amd64/dnslookup /usr/bin \
|
||||
&& rm dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& rm -rf /linux-amd64
|
||||
&& rm -rf /linux-amd64 \
|
||||
&& wget https://github.com/SagerNet/sing-box/releases/download/v1.8.11/sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& tar -xf sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& mv sing-box-1.8.11-linux-amd64/sing-box /usr/bin \
|
||||
&& rm sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& rm -rf /sing-box-1.8.11-linux-amd64
|
||||
ENV ENV="/root/.ashrc"
|
||||
|
||||
@@ -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,5 +1,16 @@
|
||||
FROM ubuntu:22.04
|
||||
RUN apt update && apt install -y curl gpg socat lsb-release \
|
||||
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
|
||||
|
||||
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 \
|
||||
|
||||
@@ -9,7 +9,7 @@ d: # остановка контейнеров
|
||||
docker compose down --remove-orphans
|
||||
dv: # остановка контейнеров
|
||||
docker compose down -v
|
||||
r: d cleanf u cleanf
|
||||
r: d u
|
||||
ps: # список контейнеров
|
||||
docker compose ps
|
||||
l: # логи из контейнеров
|
||||
@@ -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
+8
@@ -1,6 +1,14 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
ssh-keygen -A
|
||||
exec /usr/sbin/sshd -D -e "$@" &
|
||||
warp-svc > /dev/null &
|
||||
sleep 3
|
||||
warp-cli --accept-tos registration new
|
||||
key=$(cat /config/pac.json | jq -r .warp)
|
||||
if [ ! -z "$key" ]
|
||||
then
|
||||
warp-cli --accept-tos registration license $key
|
||||
fi
|
||||
warp-cli --accept-tos mode proxy
|
||||
warp-cli --accept-tos connect
|
||||
socat TCP-LISTEN:4000,fork TCP:127.0.0.1:40000
|
||||
|
||||
Regular → Executable
@@ -0,0 +1,2 @@
|
||||
winsw3.exe stop
|
||||
winsw3.exe start
|
||||
@@ -1,35 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "exe_path=sing-box.exe"
|
||||
set "URL=~url~"
|
||||
set "FileName=config.json"
|
||||
set "PreviousHash="
|
||||
|
||||
taskkill /IM "%exe_path%" /F
|
||||
powershell -command "(New-Object System.Net.WebClient).DownloadFile('%URL%', '%FileName%')"
|
||||
for /F "skip=1 delims=" %%H in ('2^>nul CertUtil -hashfile "%FileName%" SHA256') do (
|
||||
if not defined PreviousHash set "PreviousHash=%%H"
|
||||
)
|
||||
start "" /B "%CD%\%exe_path%" run -c "%FileName%"
|
||||
echo "%PreviousHash%"
|
||||
:loop
|
||||
powershell -command "(New-Object System.Net.WebClient).DownloadFile('%URL%', '%FileName%')"
|
||||
for /F "skip=1 delims=" %%H in ('2^>nul CertUtil -hashfile "%FileName%" SHA256') do (
|
||||
if not defined HASH set "HASH=%%H"
|
||||
)
|
||||
set "CurrentHash=%HASH%"
|
||||
set "HASH="
|
||||
echo "%CurrentHash%"
|
||||
if "%CurrentHash%" NEQ "%PreviousHash%" (
|
||||
echo "change"
|
||||
set "PreviousHash=%CurrentHash%"
|
||||
taskkill /IM "%exe_path%" /F
|
||||
start "" /B "%CD%\%exe_path%" run -c "%FileName%"
|
||||
) else (
|
||||
echo "not change"
|
||||
)
|
||||
|
||||
timeout /t 15 /nobreak
|
||||
|
||||
goto :loop
|
||||
@@ -2,7 +2,8 @@
|
||||
<id>singbox</id>
|
||||
<name>singbox</name>
|
||||
<description>singbox</description>
|
||||
<executable>%BASE%\update.cmd</executable>
|
||||
<executable>%BASE%\sing-box.exe</executable>
|
||||
<arguments>run -c %BASE%\config.json</arguments>
|
||||
<logmode>rotate</logmode>
|
||||
<onfailure action="restart" delay="10 sec" />
|
||||
<onfailure action="restart" delay="20 sec" />
|
||||
@@ -12,4 +13,5 @@
|
||||
<onexit action="restart" />
|
||||
<onexit action="restart" />
|
||||
<onexit action="none" />
|
||||
<download from="~url~" to="%BASE%\config.json"/>
|
||||
</service>
|
||||
Regular → Executable
@@ -1,3 +1,27 @@
|
||||
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
|
||||
- формирование rule_set из шаблона singbox
|
||||
18.04.2024 v1.33
|
||||
- вывод статуса warp в меню
|
||||
18.04.2024 v1.32
|
||||
- фиксы в названии и отображении выбранного шаблона xtls
|
||||
18.04.2024 v1.31
|
||||
- возможность устанавливать ключ для warp
|
||||
16.04.2024 v1.30.1
|
||||
- улучшение сообщения об обновлениях
|
||||
16.04.2024 v1.30
|
||||
|
||||
Reference in New Issue
Block a user