Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0538d04397 | |||
| af9933676d | |||
| 7bfebe8096 | |||
| ae61a38dbc | |||
| e727f6552c | |||
| cfd500d48a | |||
| ff87ee1055 | |||
| 3375293be5 | |||
| 6e5f198e23 | |||
| b10aaff459 | |||
| 3271561418 | |||
| 295ee6f2aa | |||
| 7ce7c56c1b | |||
| dca34de723 | |||
| eb1ad21c88 | |||
| a3ca7d9ed8 | |||
| 60ba3cf15c | |||
| cd8bcbe05a | |||
| 6cc05c88e7 | |||
| 795c357897 |
+245
-43
@@ -139,12 +139,21 @@ class Bot
|
|||||||
case preg_match('~^/mirror$~', $this->input['message'], $m):
|
case preg_match('~^/mirror$~', $this->input['message'], $m):
|
||||||
$this->menu('mirror');
|
$this->menu('mirror');
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/autoupdate$~', $this->input['message'], $m):
|
||||||
|
$this->autoupdate();
|
||||||
|
break;
|
||||||
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
|
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
|
||||||
$this->appOutbound();
|
$this->appOutbound();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/offWarp$~', $this->input['callback'], $m):
|
||||||
|
$this->offWarp();
|
||||||
|
break;
|
||||||
case preg_match('~^/addSubdomain$~', $this->input['callback'], $m):
|
case preg_match('~^/addSubdomain$~', $this->input['callback'], $m):
|
||||||
$this->addSubdomain();
|
$this->addSubdomain();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/addLinkDomain$~', $this->input['callback'], $m):
|
||||||
|
$this->addLinkDomain();
|
||||||
|
break;
|
||||||
case preg_match('~^/id$~', $this->input['message'], $m):
|
case preg_match('~^/id$~', $this->input['message'], $m):
|
||||||
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
||||||
break;
|
break;
|
||||||
@@ -337,6 +346,9 @@ class Bot
|
|||||||
case preg_match('~^/switchTorrent (\d+)$~', $this->input['callback'], $m):
|
case preg_match('~^/switchTorrent (\d+)$~', $this->input['callback'], $m):
|
||||||
$this->switchTorrent($m[1]);
|
$this->switchTorrent($m[1]);
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/switchEndpoint (\d+)$~', $this->input['callback'], $m):
|
||||||
|
$this->switchEndpoint($m[1]);
|
||||||
|
break;
|
||||||
case preg_match('~^/switchAmnezia (-?\d+)$~', $this->input['callback'], $m):
|
case preg_match('~^/switchAmnezia (-?\d+)$~', $this->input['callback'], $m):
|
||||||
$this->switchAmnezia($m[1]);
|
$this->switchAmnezia($m[1]);
|
||||||
break;
|
break;
|
||||||
@@ -1090,6 +1102,10 @@ class Bot
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
if ($this->getPacConf()['autoupdate']) {
|
||||||
|
$this->input['chat'] = $this->input['from'] = $c['admin'][0];
|
||||||
|
$this->applyupdatebot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1356,6 +1372,7 @@ class Bot
|
|||||||
$out[] = 'update xray';
|
$out[] = 'update xray';
|
||||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||||
$this->restartXray($json['xray']);
|
$this->restartXray($json['xray']);
|
||||||
|
$this->adguardXrayClients();
|
||||||
$this->setUpstreamDomain($json['pac']['transport'] == 'Websocket' ? 't' : ($json['pac']['reality']['domain'] ?: $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]));
|
$this->setUpstreamDomain($json['pac']['transport'] == 'Websocket' ? 't' : ($json['pac']['reality']['domain'] ?: $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]));
|
||||||
}
|
}
|
||||||
// ocserv
|
// ocserv
|
||||||
@@ -1526,6 +1543,14 @@ class Bot
|
|||||||
$this->menu('wg', $page);
|
$this->menu('wg', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function switchEndpoint($page = 0)
|
||||||
|
{
|
||||||
|
$c = $this->getPacConf();
|
||||||
|
$c[$this->getInstanceWG(1) . 'endpoint'] = $c[$this->getInstanceWG(1) . 'endpoint'] ? 0 : 1;
|
||||||
|
$this->setPacConf($c);
|
||||||
|
$this->menu('wg', $page);
|
||||||
|
}
|
||||||
|
|
||||||
public function iptablesWG()
|
public function iptablesWG()
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
@@ -1590,7 +1615,7 @@ class Bot
|
|||||||
{
|
{
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$ip = $this->ip;
|
$ip = $this->ip;
|
||||||
$domain = $conf['domain'] ?: $ip;
|
$domain = $this->getDomain();
|
||||||
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$ss = $this->getSSConfig();
|
$ss = $this->getSSConfig();
|
||||||
$port = !empty($ss['plugin']) ? (!empty($ssl) ? 443 : 80) : getenv('SSPORT');
|
$port = !empty($ss['plugin']) ? (!empty($ssl) ? 443 : 80) : getenv('SSPORT');
|
||||||
@@ -2077,10 +2102,41 @@ class Bot
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addLinkDomain()
|
||||||
|
{
|
||||||
|
$r = $this->send(
|
||||||
|
$this->input['chat'],
|
||||||
|
"@{$this->input['username']} enter domain for link",
|
||||||
|
$this->input['message_id'],
|
||||||
|
reply: 'enter domain for link',
|
||||||
|
);
|
||||||
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||||
|
'start_message' => $this->input['message_id'],
|
||||||
|
'callback' => 'setLinkDomain',
|
||||||
|
'args' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLinkDomain($text)
|
||||||
|
{
|
||||||
|
$c = $this->getPacConf();
|
||||||
|
if (empty($text)) {
|
||||||
|
unset($c['linkdomain']);
|
||||||
|
} else {
|
||||||
|
$c['linkdomain'] = trim($text);
|
||||||
|
}
|
||||||
|
$this->setPacConf($c);
|
||||||
|
$this->xray();
|
||||||
|
}
|
||||||
|
|
||||||
public function setSubdomain($text)
|
public function setSubdomain($text)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$c['subdomain'] = array_filter(explode(',', $text), fn($e) => !empty(trim($e)));
|
if (empty($text)) {
|
||||||
|
unset($c['subdomain']);
|
||||||
|
} else {
|
||||||
|
$c['subdomain'] = array_filter(explode(',', $text), fn($e) => !empty(trim($e)));
|
||||||
|
}
|
||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
$this->menu('config');
|
$this->menu('config');
|
||||||
}
|
}
|
||||||
@@ -2152,6 +2208,61 @@ class Bot
|
|||||||
$this->menu('adguard');
|
$this->menu('adguard');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function guidv4($data = null) {
|
||||||
|
// Generate 16 bytes (128 bits) of random data or use the data passed into the function.
|
||||||
|
$data = $data ?? random_bytes(16);
|
||||||
|
assert(strlen($data) == 16);
|
||||||
|
|
||||||
|
// Set version to 0100
|
||||||
|
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||||
|
// Set bits 6-7 to 10
|
||||||
|
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||||
|
|
||||||
|
// Output the 36 character UUID.
|
||||||
|
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function adguardXrayClients()
|
||||||
|
{
|
||||||
|
$xr = $this->getXray();
|
||||||
|
$ad = yaml_parse_file($this->adguard);
|
||||||
|
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||||
|
$tmp[] = [
|
||||||
|
'safe_search' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'bing' => true,
|
||||||
|
'duckduckgo' => true,
|
||||||
|
'google' => true,
|
||||||
|
'pixabay' => true,
|
||||||
|
'yandex' => true,
|
||||||
|
'youtube' => true,
|
||||||
|
],
|
||||||
|
'blocked_services' => [
|
||||||
|
'schedule' => ['time_zone' => date_default_timezone_get()],
|
||||||
|
'ids' => [],
|
||||||
|
],
|
||||||
|
'name' => $v['email'],
|
||||||
|
'ids' => [$v['id']],
|
||||||
|
'tags' => [],
|
||||||
|
'upstreams' => [],
|
||||||
|
'uid' => $v['id'],
|
||||||
|
'upstreams_cache_size' => 0,
|
||||||
|
'upstreams_cache_enabled' => false,
|
||||||
|
'use_global_settings' => true,
|
||||||
|
'filtering_enabled' => false,
|
||||||
|
'parental_enabled' => false,
|
||||||
|
'safebrowsing_enabled' => false,
|
||||||
|
'use_global_blocked_services' => true,
|
||||||
|
'ignore_querylog' => false,
|
||||||
|
'ignore_statistics' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$ad['clients']['persistent'] = $tmp;
|
||||||
|
yaml_emit_file($this->adguard, $ad);
|
||||||
|
$this->stopAd();
|
||||||
|
$this->startAd();
|
||||||
|
}
|
||||||
|
|
||||||
public function checkdns()
|
public function checkdns()
|
||||||
{
|
{
|
||||||
$r = $this->send(
|
$r = $this->send(
|
||||||
@@ -2578,6 +2689,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$dns = $c[$this->getInstanceWG(1) . 'dns'];
|
$dns = $c[$this->getInstanceWG(1) . 'dns'];
|
||||||
$mtu = $c[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu;
|
$mtu = $c[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu;
|
||||||
$am = $c[$this->getInstanceWG(1) . 'amnezia'];
|
$am = $c[$this->getInstanceWG(1) . 'amnezia'];
|
||||||
|
$end = $c[$this->getInstanceWG(1) . 'endpoint'];
|
||||||
$data = [
|
$data = [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
@@ -2609,6 +2721,12 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => "/defaultMTU $page",
|
'callback_data' => "/defaultMTU $page",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('endpoint') . ': ' . ($end ? $this->ip : $this->getDomain()),
|
||||||
|
'callback_data' => "/switchEndpoint $page",
|
||||||
|
],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('add peer'),
|
'text' => $this->i18n('add peer'),
|
||||||
@@ -3175,7 +3293,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$mpac = stat(__DIR__ . '/zapretlists/mpac');
|
$mpac = stat(__DIR__ . '/zapretlists/mpac');
|
||||||
$pac = stat(__DIR__ . '/zapretlists/pac');
|
$pac = stat(__DIR__ . '/zapretlists/pac');
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$ip = $conf['domain'] ?: $this->ip;
|
$ip = $this->getDomain();
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$text = <<<text
|
$text = <<<text
|
||||||
@@ -3587,7 +3705,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$ip = $this->ip;
|
$ip = $this->ip;
|
||||||
$domain = $conf['domain'] ?: $ip;
|
$domain = $this->getDomain();
|
||||||
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$ss = $this->getSSConfig();
|
$ss = $this->getSSConfig();
|
||||||
$v2ray = !empty($ss['plugin']) ? 'ON' : 'OFF';
|
$v2ray = !empty($ss['plugin']) ? 'ON' : 'OFF';
|
||||||
@@ -3767,7 +3885,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$domain = $this->getDomain($pac['transport'] == 'Websocket');
|
||||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
@@ -3841,8 +3959,9 @@ DNS-over-HTTPS with IP:
|
|||||||
public function naiveMenu()
|
public function naiveMenu()
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
|
$domain = $this->getDomain();
|
||||||
$text[] = "Menu -> NaiveProxy";
|
$text[] = "Menu -> NaiveProxy";
|
||||||
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@np.{$pac['domain']}</code>";
|
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@np.$domain</code>";
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('change login'),
|
'text' => $this->i18n('change login'),
|
||||||
@@ -3934,6 +4053,7 @@ DNS-over-HTTPS with IP:
|
|||||||
public function ocMenu()
|
public function ocMenu()
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
|
$domain = $this->getDomain();
|
||||||
$ocserv = file_get_contents('/config/ocserv.conf');
|
$ocserv = file_get_contents('/config/ocserv.conf');
|
||||||
preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m);
|
preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m);
|
||||||
$cs = $m[1];
|
$cs = $m[1];
|
||||||
@@ -3942,7 +4062,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$pass = htmlspecialchars($pac['ocserv']);
|
$pass = htmlspecialchars($pac['ocserv']);
|
||||||
$text[] = "Menu -> OpenConnect";
|
$text[] = "Menu -> OpenConnect";
|
||||||
if (!empty($m[1])) {
|
if (!empty($m[1])) {
|
||||||
$text[] = "<code>https://oc.{$pac['domain']}/?$cs</code>";
|
$text[] = "<code>https://oc.$domain/?$cs</code>";
|
||||||
}
|
}
|
||||||
$text[] = "password: <span class='tg-spoiler'>$pass</span>";
|
$text[] = "password: <span class='tg-spoiler'>$pass</span>";
|
||||||
$data[] = [
|
$data[] = [
|
||||||
@@ -4005,6 +4125,7 @@ DNS-over-HTTPS with IP:
|
|||||||
if ($i == $k) {
|
if ($i == $k) {
|
||||||
unset($r['inbounds'][0]['settings']['clients'][$k]);
|
unset($r['inbounds'][0]['settings']['clients'][$k]);
|
||||||
$this->restartXray($r);
|
$this->restartXray($r);
|
||||||
|
$this->adguardXrayClients();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4038,6 +4159,7 @@ DNS-over-HTTPS with IP:
|
|||||||
'email' => $user,
|
'email' => $user,
|
||||||
];
|
];
|
||||||
$this->restartXray($c);
|
$this->restartXray($c);
|
||||||
|
$this->adguardXrayClients();
|
||||||
$this->userXr(count($c['inbounds'][0]['settings']['clients']) - 1);
|
$this->userXr(count($c['inbounds'][0]['settings']['clients']) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4084,6 +4206,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['email'] = $name;
|
$c['inbounds'][0]['settings']['clients'][$i]['email'] = $name;
|
||||||
$this->restartXray($c);
|
$this->restartXray($c);
|
||||||
|
$this->adguardXrayClients();
|
||||||
$this->userXr($i);
|
$this->userXr($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4159,7 +4282,7 @@ DNS-over-HTTPS with IP:
|
|||||||
public function templates($type)
|
public function templates($type)
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$domain = $this->getDomain();
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> $type templates";
|
$text[] = "Menu -> " . $this->i18n('xray') . " -> $type templates";
|
||||||
$templates = $pac["{$type}templates"];
|
$templates = $pac["{$type}templates"];
|
||||||
@@ -4227,6 +4350,12 @@ DNS-over-HTTPS with IP:
|
|||||||
$text[] = "fake domain: <code>$fake</code>";
|
$text[] = "fake domain: <code>$fake</code>";
|
||||||
}
|
}
|
||||||
$text[] = 'transport: ' . ($p['transport'] ?: 'Reality');
|
$text[] = 'transport: ' . ($p['transport'] ?: 'Reality');
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $p['linkdomain'] ?: $this->i18n('cdn'),
|
||||||
|
'callback_data' => '/addLinkDomain',
|
||||||
|
],
|
||||||
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] != 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] != 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
||||||
@@ -4384,33 +4513,67 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function addWarpPlus($key)
|
public function addWarpPlus($key)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$c['warp'] = $key;
|
if (!empty($key)) {
|
||||||
|
$c['warp'] = $key;
|
||||||
|
$this->send($this->input['chat'], 'Warp registration license: ' . $this->ssh("warp-cli --accept-tos registration license $key 2>&1", 'wp'));
|
||||||
|
} else {
|
||||||
|
unset($c['warp']);
|
||||||
|
}
|
||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
$this->send($this->input['chat'], 'Warp registration license: ' . $this->ssh("warp-cli --accept-tos registration license $key", 'wp'));
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$this->warp();
|
$this->warp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function warpStatus()
|
public function warpStatus()
|
||||||
{
|
{
|
||||||
$st = $this->ssh('curl -m 1 -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp');
|
if (!empty($this->ssh('pgrep warp-svc', 'wp'))) {
|
||||||
preg_match('~warp=(\w+)~', $st, $m);
|
$st = $this->ssh('curl -m 1 -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp');
|
||||||
return $m[1];
|
preg_match('~warp=(\w+)~', $st, $m);
|
||||||
|
return $m[1];
|
||||||
|
}
|
||||||
|
return 'off';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offWarp()
|
||||||
|
{
|
||||||
|
$p = $this->getPacConf();
|
||||||
|
if (empty($p['warpoff'])) {
|
||||||
|
$this->ssh('pkill warp-svc', 'wp');
|
||||||
|
$p['warpoff'] = 1;
|
||||||
|
} else {
|
||||||
|
$this->ssh('warp-svc > /dev/null 2>&1 &', 'wp');
|
||||||
|
sleep(3);
|
||||||
|
$this->send($this->input['chat'], 'Registration: ' . $this->ssh('warp-cli --accept-tos registration new 2>&1', 'wp'));
|
||||||
|
if (!empty($p['warp'])) {
|
||||||
|
$this->send($this->input['chat'], 'License: ' . $this->ssh("warp-cli --accept-tos registration license {$p['warp']} 2>&1", 'wp'));
|
||||||
|
}
|
||||||
|
$this->send($this->input['chat'], 'Proxy mode: ' . $this->ssh('warp-cli --accept-tos mode proxy 2>&1', 'wp'));
|
||||||
|
$this->send($this->input['chat'], 'Connect: ' . $this->ssh('warp-cli --accept-tos connect 2>&1', 'wp'));
|
||||||
|
unset($p['warpoff']);
|
||||||
|
}
|
||||||
|
$this->setPacConf($p);
|
||||||
|
$this->warp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function warp()
|
public function warp()
|
||||||
{
|
{
|
||||||
|
$p = $this->getPacConf();
|
||||||
$text[] = "Menu -> " . $this->i18n('warp');
|
$text[] = "Menu -> " . $this->i18n('warp');
|
||||||
$text[] = "status: " . $this->warpStatus();
|
$text[] = "status: " . $this->warpStatus();
|
||||||
$text[] = "key: " . $this->getPacConf()['warp'];
|
$text[] = "key: " . $this->getPacConf()['warp'];
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n($p['warpoff'] ? 'off' : 'on'),
|
||||||
|
'callback_data' => "/offWarp",
|
||||||
|
],
|
||||||
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('set key'),
|
'text' => $this->i18n('set key'),
|
||||||
'callback_data' => "/warpPlus",
|
'callback_data' => "/warpPlus",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('back'),
|
'text' => $this->i18n('back'),
|
||||||
@@ -4482,7 +4645,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$c = $this->getXray()['inbounds'][0]['settings']['clients'][$i];
|
$c = $this->getXray()['inbounds'][0]['settings']['clients'][$i];
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$domain = $this->getDomain($pac['transport'] == 'Websocket');
|
||||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
|
|
||||||
@@ -4494,14 +4657,27 @@ DNS-over-HTTPS with IP:
|
|||||||
$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=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=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[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=h&s={$c['id']}#{$c['email']}'>hiddify</a>";
|
||||||
|
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=k&s={$c['id']}#{$c['email']}'>karing</a>";
|
||||||
|
|
||||||
|
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 'si',
|
||||||
|
's' => $c['id'],
|
||||||
|
]));
|
||||||
|
$xr = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 's',
|
||||||
|
's' => $c['id'],
|
||||||
|
]));
|
||||||
|
|
||||||
|
$text[] = "\nxray config: <pre><code>$xr</code></pre>";
|
||||||
|
$text[] = "sing-box config: <pre><code>$si</code></pre>";
|
||||||
|
|
||||||
$text[] = "\nv2ray config: <pre><code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code></pre>";
|
|
||||||
$text[] = "sing-box config: <pre><code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code></pre>";
|
|
||||||
$text[] = "sing-box windows: <a href='$scheme://{$domain}/pac?h=$hash&t=si&r=w&s={$c['id']}'>windows service</a>";
|
$text[] = "sing-box windows: <a href='$scheme://{$domain}/pac?h=$hash&t=si&r=w&s={$c['id']}'>windows service</a>";
|
||||||
|
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => 'v2ray',
|
'text' => 'xray',
|
||||||
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=s&s={$c['id']}"],
|
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=s&s={$c['id']}"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -4569,17 +4745,26 @@ DNS-over-HTTPS with IP:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDomain($cdn = false)
|
||||||
|
{
|
||||||
|
$c = $this->getPacConf();
|
||||||
|
if ($cdn && $c['linkdomain']) {
|
||||||
|
return $c['linkdomain'];
|
||||||
|
}
|
||||||
|
return $c['domain'] ?: $this->ip;
|
||||||
|
}
|
||||||
|
|
||||||
public function v2raySubscription($key, $fs = 0)
|
public function v2raySubscription($key, $fs = 0)
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$domain = $this->getDomain();
|
||||||
$xr = $this->getXray();
|
$xr = $this->getXray();
|
||||||
|
|
||||||
$flag = true;
|
$flag = true;
|
||||||
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||||
if ($v['id'] == $key) {
|
if ($v['id'] == $key) {
|
||||||
if (!empty($fs)) {
|
if (!empty($fs)) {
|
||||||
return $this->userXr($k, 0, 1);
|
return $this->userXr($k);
|
||||||
}
|
}
|
||||||
if (empty($v['off'])) {
|
if (empty($v['off'])) {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
@@ -4612,7 +4797,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$domain = $_GET['cdn'] ?: ($_SERVER['SERVER_NAME'] ?: $this->getDomain($pac['transport'] == 'Websocket'));
|
||||||
$xr = $this->getXray();
|
$xr = $this->getXray();
|
||||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
@@ -4625,6 +4810,7 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
$template = base64_decode($v["{$type}template"]);
|
$template = base64_decode($v["{$type}template"]);
|
||||||
$uid = $v['id'];
|
$uid = $v['id'];
|
||||||
|
$email = $v['email'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4653,20 +4839,20 @@ DNS-over-HTTPS with IP:
|
|||||||
case 'v':
|
case 'v':
|
||||||
header("Location: v2rayng://install-config?url=$v2");
|
header("Location: v2rayng://install-config?url=$v2");
|
||||||
exit;
|
exit;
|
||||||
|
case 'k':
|
||||||
|
header("Location: karing://install-config?url=$si");
|
||||||
|
exit;
|
||||||
case 'h':
|
case 'h':
|
||||||
header("Location: hiddify://install-config/?url=$si");
|
header("Location: hiddify://install-config/?url=$si");
|
||||||
exit;
|
exit;
|
||||||
case 'w':
|
case 'w':
|
||||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||||
file_put_contents('/singbox/winsw3.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw3.xml')));
|
file_put_contents('/singbox/winsw3.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw3.xml')));
|
||||||
$zip = new ZipArchive();
|
|
||||||
$n = "singbox_$uid.zip";
|
$n = "singbox_$uid.zip";
|
||||||
$zip->open($n, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
copy('/singbox/singbox.zip', $n);
|
||||||
foreach (scandir('/singbox') as $k => $v) {
|
$zip = new ZipArchive();
|
||||||
if (!empty(!in_array($v, ['.', '..']))) {
|
$zip->open($n, ZipArchive::CREATE);
|
||||||
$zip->addFile("/singbox/$v", $v);
|
$zip->addFile('/singbox/winsw3.xml', 'winsw3.xml');
|
||||||
}
|
|
||||||
}
|
|
||||||
$zip->close();
|
$zip->close();
|
||||||
header('Content-Disposition: attachment; filename="singbox.zip"');
|
header('Content-Disposition: attachment; filename="singbox.zip"');
|
||||||
echo file_get_contents($n);
|
echo file_get_contents($n);
|
||||||
@@ -4692,7 +4878,7 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
switch ($_GET['t']) {
|
switch ($_GET['t']) {
|
||||||
case 's':
|
case 's':
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $_GET['cdn'] ?: $domain;
|
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['users'][0] = [
|
$c['outbounds'][0]['settings']['vnext'][0]['users'][0] = [
|
||||||
'id' => $uid,
|
'id' => $uid,
|
||||||
'encryption' => 'none',
|
'encryption' => 'none',
|
||||||
@@ -4706,7 +4892,7 @@ DNS-over-HTTPS with IP:
|
|||||||
],
|
],
|
||||||
"tlsSettings" => [
|
"tlsSettings" => [
|
||||||
"allowInsecure" => false,
|
"allowInsecure" => false,
|
||||||
"serverName" => $_GET['cdn'] ?: $domain,
|
"serverName" => $domain,
|
||||||
"fingerprint" => "chrome"
|
"fingerprint" => "chrome"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@@ -4741,10 +4927,10 @@ DNS-over-HTTPS with IP:
|
|||||||
break;
|
break;
|
||||||
case 'si':
|
case 'si':
|
||||||
if ($c['dns']['servers'][0]['address'] == '~dns~') {
|
if ($c['dns']['servers'][0]['address'] == '~dns~') {
|
||||||
$c['dns']['servers'][0]['address'] = "tls://" . ($pac['adguardkey'] ? "{$pac['adguardkey']}." : '') . "$domain";
|
$c['dns']['servers'][0]['address'] = "https://$domain/dns-query/$uid";
|
||||||
}
|
}
|
||||||
|
|
||||||
$c['outbounds'][0]['server'] = $_GET['cdn'] ?: $domain;
|
$c['outbounds'][0]['server'] = $domain;
|
||||||
$c['outbounds'][0]['uuid'] = $uid;
|
$c['outbounds'][0]['uuid'] = $uid;
|
||||||
if ($pac['transport'] == 'Websocket') {
|
if ($pac['transport'] == 'Websocket') {
|
||||||
unset($c['outbounds'][0]['tls']['reality']);
|
unset($c['outbounds'][0]['tls']['reality']);
|
||||||
@@ -4753,7 +4939,7 @@ DNS-over-HTTPS with IP:
|
|||||||
"type" => "ws",
|
"type" => "ws",
|
||||||
"path" => "/ws"
|
"path" => "/ws"
|
||||||
];
|
];
|
||||||
$c['outbounds'][0]['tls']['server_name'] = $_GET['cdn'] ?: $domain;
|
$c['outbounds'][0]['tls']['server_name'] = $domain;
|
||||||
} else {
|
} else {
|
||||||
unset($c['outbounds'][0]["transport"]);
|
unset($c['outbounds'][0]["transport"]);
|
||||||
$c['outbounds'][0]['flow'] = 'xtls-rprx-vision';
|
$c['outbounds'][0]['flow'] = 'xtls-rprx-vision';
|
||||||
@@ -4773,7 +4959,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$c['route']['rules'] = array_values($c['route']['rules']);
|
$c['route']['rules'] = array_values($c['route']['rules']);
|
||||||
$c['route'] = $this->addRuleSet($c['route']);
|
$c['route'] = $this->addRuleSet($c['route']);
|
||||||
$c['route'] = $this->addPackageRule($c['route']);
|
$c['route'] = $this->addPackageRule($c['route']);
|
||||||
$c['route'] = $this->createRuleSet($c['route'], $uid);
|
$c['route'] = $this->createRuleSet($c['route'], $uid, $domain);
|
||||||
$c['route'] = $this->clearEmptyRules($c['route']);
|
$c['route'] = $this->clearEmptyRules($c['route']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -4830,10 +5016,9 @@ DNS-over-HTTPS with IP:
|
|||||||
return $route;
|
return $route;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createRuleSet($route, $uid)
|
public function createRuleSet($route, $uid, $domain)
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
|
||||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
|
|
||||||
@@ -4876,12 +5061,12 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
$ruleset[] = [
|
$ruleset[] = [
|
||||||
"tag" => $r['name'],
|
"tag" => $r['name'],
|
||||||
"url" => "$scheme://{$domain}/pac?" . http_build_query([
|
"url" => "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
'h' => $hash,
|
'h' => $hash,
|
||||||
't' => 'si',
|
't' => 'si',
|
||||||
's' => $uid,
|
's' => $uid,
|
||||||
'r' => $r['name'],
|
'r' => $r['name'],
|
||||||
]),
|
])),
|
||||||
"update_interval" => $r['interval'],
|
"update_interval" => $r['interval'],
|
||||||
"type" => "remote",
|
"type" => "remote",
|
||||||
"format" => "binary",
|
"format" => "binary",
|
||||||
@@ -5050,7 +5235,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$ip = $this->ip;
|
$ip = $this->ip;
|
||||||
$domain = $conf['domain'] ?: $ip;
|
$domain = $this->getDomain();
|
||||||
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
$text = "$scheme://$domain/adguard\nLogin: admin\nPass: <span class='tg-spoiler'>{$conf['adpswd']}</span>\n\n";
|
$text = "$scheme://$domain/adguard\nLogin: admin\nPass: <span class='tg-spoiler'>{$conf['adpswd']}</span>\n\n";
|
||||||
if ($ssl) {
|
if ($ssl) {
|
||||||
@@ -5154,6 +5339,15 @@ DNS-over-HTTPS with IP:
|
|||||||
return openssl_x509_parse($c)["validTo_time_t"] ?: false;
|
return openssl_x509_parse($c)["validTo_time_t"] ?: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function domainsCert()
|
||||||
|
{
|
||||||
|
$domains = openssl_x509_parse(openssl_x509_read(file_get_contents("/certs/cert_public")))['extensions']["subjectAltName"];
|
||||||
|
if (empty($domains)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return implode("\n", array_map(fn($e) => trim($e), explode(',', str_replace('DNS:', '', $domains))));
|
||||||
|
}
|
||||||
|
|
||||||
public function updatebot()
|
public function updatebot()
|
||||||
{
|
{
|
||||||
$b = exec('git -C / rev-parse --abbrev-ref HEAD');
|
$b = exec('git -C / rev-parse --abbrev-ref HEAD');
|
||||||
@@ -5216,7 +5410,7 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\nnp.{$conf['domain']} (for naiveproxy)\noc.{$conf['domain']} (for openconnect)" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']} (for adguard DoT)" : '') . $custom : $this->i18n('domain explain');
|
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\nnp.{$conf['domain']} (for naiveproxy)\noc.{$conf['domain']} (for openconnect)" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']} (for adguard DoT)" : '') . $custom : $this->i18n('domain explain');
|
||||||
$ssl = $this->expireCert();
|
$ssl = $this->expireCert();
|
||||||
$text[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) : 'none') : '';
|
$text[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) . "\n" . $this->domainsCert() : 'none') : '';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
[
|
[
|
||||||
@@ -5225,7 +5419,7 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('subdomain'),
|
'text' => $this->i18n('+ subdomain'),
|
||||||
'callback_data' => '/addSubdomain',
|
'callback_data' => '/addSubdomain',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -5723,7 +5917,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$conf[] = '';
|
$conf[] = '';
|
||||||
$conf[] = $peer['# PublicKey'] ? '# [Peer]' : '[Peer]';
|
$conf[] = $peer['# PublicKey'] ? '# [Peer]' : '[Peer]';
|
||||||
if (!empty($peer['Endpoint'])) {
|
if (!empty($peer['Endpoint'])) {
|
||||||
$peer['Endpoint'] = ($pac['domain'] && !$pac[$this->getInstanceWG(1) . 'amnezia'] ? $pac['domain'] : $this->ip) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
|
$peer['Endpoint'] = ($this->getPacConf()[$this->getInstanceWG(1) . 'endpoint'] ? $this->ip : $this->getDomain()) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
|
||||||
}
|
}
|
||||||
foreach ($peer as $k => $v) {
|
foreach ($peer as $k => $v) {
|
||||||
$conf[] = "$k = $v";
|
$conf[] = "$k = $v";
|
||||||
@@ -5882,6 +6076,14 @@ DNS-over-HTTPS with IP:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function autoupdate()
|
||||||
|
{
|
||||||
|
$p = $this->getPacConf();
|
||||||
|
$p['autoupdate'] = !$p['autoupdate'];
|
||||||
|
$this->setPacConf($p);
|
||||||
|
$this->send($this->input['from'], $this->i18n('autoupdate') . ' ' . $this->i18n($p['autoupdate'] ? 'on' : 'off'));
|
||||||
|
}
|
||||||
|
|
||||||
public function disconnect(...$args)
|
public function disconnect(...$args)
|
||||||
{
|
{
|
||||||
$this->send($this->input['chat'], "disconnect: \n" . var_export($args, true) . "\n", $this->input['message_id']);
|
$this->send($this->input['chat'], "disconnect: \n" . var_export($args, true) . "\n", $this->input['message_id']);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ http {
|
|||||||
}
|
}
|
||||||
location /pac {
|
location /pac {
|
||||||
access_log /logs/nginx_pac_access;
|
access_log /logs/nginx_pac_access;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
proxy_pass http://php;
|
proxy_pass http://php;
|
||||||
}
|
}
|
||||||
location /tlgrm {
|
location /tlgrm {
|
||||||
@@ -75,6 +76,27 @@ http {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_read_timeout 5d;
|
proxy_read_timeout 5d;
|
||||||
}
|
}
|
||||||
|
#-ssl
|
||||||
|
# # The DoH server block
|
||||||
|
# location /dns-query {
|
||||||
|
# access_log /logs/nginx_doh_access;
|
||||||
|
# # Proxy HTTP/1.1, clear the connection header to enable Keep-Alive
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Connection "";
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-Proto https;
|
||||||
|
# proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-Host $remote_addr;
|
||||||
|
|
||||||
|
# # Enable Cache, and set the cache_key to include the request_body
|
||||||
|
# proxy_cache doh_cache;
|
||||||
|
# proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||||
|
|
||||||
|
# # proxy pass to the dohloop upstream
|
||||||
|
# proxy_pass https://ad/dns-query;
|
||||||
|
# }
|
||||||
|
#-ssl
|
||||||
location ~\.well-known {
|
location ~\.well-known {
|
||||||
access_log /logs/nginx_certbot_access;
|
access_log /logs/nginx_certbot_access;
|
||||||
root /certs/;
|
root /certs/;
|
||||||
@@ -118,6 +140,7 @@ http {
|
|||||||
# }
|
# }
|
||||||
# location /pac {
|
# location /pac {
|
||||||
# access_log /logs/nginx_pac_access;
|
# access_log /logs/nginx_pac_access;
|
||||||
|
# proxy_set_header Host $http_host;
|
||||||
# proxy_pass http://php;
|
# proxy_pass http://php;
|
||||||
# }
|
# }
|
||||||
# location ~\.well-known {
|
# location ~\.well-known {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ http {
|
|||||||
}
|
}
|
||||||
location /pac {
|
location /pac {
|
||||||
access_log /logs/nginx_pac_access;
|
access_log /logs/nginx_pac_access;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
proxy_pass http://php;
|
proxy_pass http://php;
|
||||||
}
|
}
|
||||||
location /tlgrm {
|
location /tlgrm {
|
||||||
@@ -75,6 +76,27 @@ http {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_read_timeout 5d;
|
proxy_read_timeout 5d;
|
||||||
}
|
}
|
||||||
|
#-ssl
|
||||||
|
# # The DoH server block
|
||||||
|
# location /dns-query {
|
||||||
|
# access_log /logs/nginx_doh_access;
|
||||||
|
# # Proxy HTTP/1.1, clear the connection header to enable Keep-Alive
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Connection "";
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-Proto https;
|
||||||
|
# proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-Host $remote_addr;
|
||||||
|
|
||||||
|
# # Enable Cache, and set the cache_key to include the request_body
|
||||||
|
# proxy_cache doh_cache;
|
||||||
|
# proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||||
|
|
||||||
|
# # proxy pass to the dohloop upstream
|
||||||
|
# proxy_pass https://ad/dns-query;
|
||||||
|
# }
|
||||||
|
#-ssl
|
||||||
location ~\.well-known {
|
location ~\.well-known {
|
||||||
access_log /logs/nginx_certbot_access;
|
access_log /logs/nginx_certbot_access;
|
||||||
root /certs/;
|
root /certs/;
|
||||||
@@ -118,6 +140,7 @@ http {
|
|||||||
# }
|
# }
|
||||||
# location /pac {
|
# location /pac {
|
||||||
# access_log /logs/nginx_pac_access;
|
# access_log /logs/nginx_pac_access;
|
||||||
|
# proxy_set_header Host $http_host;
|
||||||
# proxy_pass http://php;
|
# proxy_pass http://php;
|
||||||
# }
|
# }
|
||||||
# location ~\.well-known {
|
# location ~\.well-known {
|
||||||
|
|||||||
+14
-14
@@ -110,6 +110,20 @@
|
|||||||
"protocol": "dns",
|
"protocol": "dns",
|
||||||
"outbound": "dns-out"
|
"outbound": "dns-out"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"createruleset": [
|
||||||
|
{
|
||||||
|
"name": "block",
|
||||||
|
"interval": "15s",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"domain_suffix": "~block~"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbound": "block"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"createruleset": [
|
"createruleset": [
|
||||||
{
|
{
|
||||||
@@ -133,20 +147,6 @@
|
|||||||
],
|
],
|
||||||
"outbound": "proxy"
|
"outbound": "proxy"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"createruleset": [
|
|
||||||
{
|
|
||||||
"name": "block",
|
|
||||||
"interval": "15s",
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"domain_suffix": "~block~"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outbound": "block"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -16,7 +16,11 @@ echo \
|
|||||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') \
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') \
|
||||||
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
apt update
|
apt update
|
||||||
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
apt install -y docker-ce docker-ce-cli containerd.io
|
||||||
|
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||||
|
mkdir -p $DOCKER_CONFIG/cli-plugins
|
||||||
|
curl -SL https://github.com/docker/compose/releases/download/v2.29.6/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
|
||||||
|
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
|
||||||
git clone https://github.com/mercurykd/vpnbot.git
|
git clone https://github.com/mercurykd/vpnbot.git
|
||||||
cd ./vpnbot
|
cd ./vpnbot
|
||||||
echo "<?php
|
echo "<?php
|
||||||
|
|||||||
+11
-7
@@ -1,14 +1,18 @@
|
|||||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||||
ssh-keygen -A
|
ssh-keygen -A
|
||||||
exec /usr/sbin/sshd -D -e "$@" &
|
exec /usr/sbin/sshd -D -e "$@" &
|
||||||
warp-svc > /dev/null &
|
off=$(cat /config/pac.json | jq -r .warpoff)
|
||||||
sleep 3
|
|
||||||
warp-cli --accept-tos registration new
|
|
||||||
key=$(cat /config/pac.json | jq -r .warp)
|
key=$(cat /config/pac.json | jq -r .warp)
|
||||||
if [ ! -z "$key" ]
|
if [ "$off" == 'null' ]
|
||||||
then
|
then
|
||||||
warp-cli --accept-tos registration license $key
|
warp-svc > /dev/null &
|
||||||
|
sleep 3
|
||||||
|
warp-cli --accept-tos registration new
|
||||||
|
if [ ! -z "$key" ]
|
||||||
|
then
|
||||||
|
warp-cli --accept-tos registration license $key
|
||||||
|
fi
|
||||||
|
warp-cli --accept-tos mode proxy
|
||||||
|
warp-cli --accept-tos connect
|
||||||
fi
|
fi
|
||||||
warp-cli --accept-tos mode proxy
|
|
||||||
warp-cli --accept-tos connect
|
|
||||||
socat TCP-LISTEN:4000,fork TCP:127.0.0.1:40000
|
socat TCP-LISTEN:4000,fork TCP:127.0.0.1:40000
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
winsw3.exe install
|
|
||||||
pause
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
winsw3.exe stop
|
|
||||||
winsw3.exe start
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
winsw3.exe start
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
winsw3.exe status
|
|
||||||
pause
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
winsw3.exe stop
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
winsw3.exe uninstall
|
|
||||||
pause
|
|
||||||
+1
-1
@@ -24,7 +24,7 @@ do
|
|||||||
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "применяю обновления"/')"
|
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "применяю обновления"/')"
|
||||||
git pull > ./update/message
|
git pull > ./update/message
|
||||||
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "запускаю бота"/')"
|
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "запускаю бота"/')"
|
||||||
IP=$(curl https://ipinfo.io/ip) VER=$(git describe --tags) docker compose up -d --force-recreate
|
IP=$(curl ipinfo.io/ip) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||||
bash $pwd/update/update.sh &
|
bash $pwd/update/update.sh &
|
||||||
> $pwd/update/key
|
> $pwd/update/key
|
||||||
> $pwd/update/curl
|
> $pwd/update/curl
|
||||||
|
|||||||
@@ -1,3 +1,34 @@
|
|||||||
|
06.10.2024 v1.63
|
||||||
|
- приоритет правила block над остальными в стандартном шаблоне sing-box
|
||||||
|
30.09.2024 v1.62
|
||||||
|
- импорт профиля xray в karing
|
||||||
|
30.09.2024 v1.61.1
|
||||||
|
- фикс удаления ключа варпа через ноль
|
||||||
|
29.09.2024 v1.61
|
||||||
|
- включение/отключение процесса warp
|
||||||
|
29.09.2024 v1.60
|
||||||
|
- ускорение сборки архива sing-box windows
|
||||||
|
23.09.2024 v1.59
|
||||||
|
- docker compose v2.29.6 (при установке бота)
|
||||||
|
22.09.2024 v1.58
|
||||||
|
- фикс запуска бота с правильными параметрами после обновления
|
||||||
|
22.09.2024 v1.57
|
||||||
|
- выбор типа endpoint для wireguard/amnezia
|
||||||
|
22.09.2024 v1.56.2
|
||||||
|
- фикс разных доменов при указании cdn для xray
|
||||||
|
19.09.2024 v1.56.1
|
||||||
|
- cdn для xray
|
||||||
|
17.09.2024 v1.55
|
||||||
|
- возможность подменить домен в ссылках на конфиги
|
||||||
|
16.09.2024 v1.54.2
|
||||||
|
- фикс нэйминга клиентов в adguardHome: замена на uuid
|
||||||
|
16.09.2024 v1.54.1
|
||||||
|
- фикс нэйминга клиентов в adguardHome
|
||||||
|
16.09.2024 v1.54
|
||||||
|
- ~dns~ в шаблоне сингбокса подменяятся на https://DOMAIN/dns-query/USERNAME
|
||||||
|
- при добавлении пользователя в XRAY, он также добавляется в AdguardHome как сохраненый клиент
|
||||||
|
10.09.2024 v1.53
|
||||||
|
- домен в endpoint для амнезии
|
||||||
10.09.2024 v1.52
|
10.09.2024 v1.52
|
||||||
- фикс спамящего уведомления о просрочке сертификата
|
- фикс спамящего уведомления о просрочке сертификата
|
||||||
10.09.2024 v1.51
|
10.09.2024 v1.51
|
||||||
|
|||||||
Reference in New Issue
Block a user