|
|
|
@@ -133,9 +133,18 @@ class Bot
|
|
|
|
|
case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m):
|
|
|
|
|
$this->changeWG($m[1]);
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/changeTransport(?: (\d+))?$~', $this->input['callback'], $m):
|
|
|
|
|
$this->changeTransport($m[1] ?: false);
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/mirror$~', $this->input['message'], $m):
|
|
|
|
|
$this->menu('mirror');
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
|
|
|
|
|
$this->appOutbound();
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/addSubdomain$~', $this->input['callback'], $m):
|
|
|
|
|
$this->addSubdomain();
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/id$~', $this->input['message'], $m):
|
|
|
|
|
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
|
|
|
|
break;
|
|
|
|
@@ -350,8 +359,8 @@ class Bot
|
|
|
|
|
case preg_match('~^/qrSS$~', $this->input['callback'], $m):
|
|
|
|
|
$this->qrSS();
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/qrXray (\d+)$~', $this->input['callback'], $m):
|
|
|
|
|
$this->qrXray($m[1]);
|
|
|
|
|
case preg_match('~^/qrXray (\d+)(?:_(\d+))?$~', $this->input['callback'], $m):
|
|
|
|
|
$this->qrXray($m[1], $m[2] ?: false);
|
|
|
|
|
break;
|
|
|
|
|
case preg_match('~^/qrMtproto$~', $this->input['callback'], $m):
|
|
|
|
|
$this->qrMtproto();
|
|
|
|
@@ -960,7 +969,7 @@ class Bot
|
|
|
|
|
if (!empty($s = trim($v))) {
|
|
|
|
|
$t = explode(';', $s);
|
|
|
|
|
if ($type == 'rulessetlist') {
|
|
|
|
|
if (preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $t[0])) {
|
|
|
|
|
if (preg_match('~^.+:.+:https?://.+~', $t[0])) {
|
|
|
|
|
$list[$t[0]] = (bool) $t[1];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@@ -1601,9 +1610,9 @@ class Bot
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function qrXray($i)
|
|
|
|
|
public function qrXray($i, $s = false)
|
|
|
|
|
{
|
|
|
|
|
$link = $this->linkXray($i);
|
|
|
|
|
$link = $this->linkXray($i, $s);
|
|
|
|
|
$qr_file = __DIR__ . "/qr/xray.png";
|
|
|
|
|
exec("qrencode -t png -o $qr_file '$link'");
|
|
|
|
|
$r = $this->sendPhoto(
|
|
|
|
@@ -1687,7 +1696,7 @@ class Bot
|
|
|
|
|
$conf = $this->getPacConf();
|
|
|
|
|
$conf['domain'] = idn_to_ascii($domain);
|
|
|
|
|
$nginx = file_get_contents('/config/nginx.conf');
|
|
|
|
|
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
|
|
|
|
|
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']} *.{$conf['domain']};", $nginx);
|
|
|
|
|
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
|
|
|
|
foreach ($m[0] as $k => $v) {
|
|
|
|
|
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
|
|
|
@@ -1797,9 +1806,9 @@ class Bot
|
|
|
|
|
case 'letsencrypt':
|
|
|
|
|
$out[] = 'Install certificate:';
|
|
|
|
|
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
|
|
|
|
$adguardClient = $this->getPacConf()['adguardkey'];
|
|
|
|
|
$adguardClient = $adguardClient ? "-d $adguardClient.{$conf['domain']}" : '';
|
|
|
|
|
exec("certbot certonly --force-renew --preferred-chain 'ISRG Root X1' -n --agree-tos --email mail@{$conf['domain']} -d {$conf['domain']} -d oc.{$conf['domain']} -d np.{$conf['domain']} $adguardClient --webroot -w /certs/ --logs-dir /logs --max-log-backups 0 2>&1", $out, $code);
|
|
|
|
|
$adguardClient = $conf['adguardkey'] ? "-d {$conf['adguardkey']}.{$conf['domain']}" : '';
|
|
|
|
|
$custom = $conf['subdomain'] ? "-d {$conf['subdomain']}.{$conf['domain']}" : '';
|
|
|
|
|
exec("certbot certonly --force-renew --preferred-chain 'ISRG Root X1' -n --agree-tos --email mail@{$conf['domain']} -d {$conf['domain']} -d oc.{$conf['domain']} -d np.{$conf['domain']} $adguardClient $custom --webroot -w /certs/ --logs-dir /logs --max-log-backups 0 2>&1", $out, $code);
|
|
|
|
|
if ($code > 0) {
|
|
|
|
|
$this->send($this->input['chat'], "ERROR\n" . implode("\n", $out));
|
|
|
|
|
break;
|
|
|
|
@@ -2048,6 +2057,30 @@ class Bot
|
|
|
|
|
'args' => [],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addSubdomain()
|
|
|
|
|
{
|
|
|
|
|
$r = $this->send(
|
|
|
|
|
$this->input['chat'],
|
|
|
|
|
"@{$this->input['username']} enter subdomain",
|
|
|
|
|
$this->input['message_id'],
|
|
|
|
|
reply: 'enter subdomain',
|
|
|
|
|
);
|
|
|
|
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
|
|
|
|
'start_message' => $this->input['message_id'],
|
|
|
|
|
'callback' => 'setSubdomain',
|
|
|
|
|
'args' => [],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setSubdomain($text)
|
|
|
|
|
{
|
|
|
|
|
$c = $this->getPacConf();
|
|
|
|
|
$c['subdomain'] = $text;
|
|
|
|
|
$this->setPacConf($c);
|
|
|
|
|
$this->menu('config');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function enterPage()
|
|
|
|
|
{
|
|
|
|
|
$r = $this->send(
|
|
|
|
@@ -2241,8 +2274,8 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
|
|
|
|
|
public function addInclude(string $domains, $type)
|
|
|
|
|
{
|
|
|
|
|
if ($type == 'rulessetlist' && !preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $domains)) {
|
|
|
|
|
$this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy]:time:URL');
|
|
|
|
|
if ($type == 'rulessetlist' && !preg_match('~^.+:.+:https?://.+~', $domains)) {
|
|
|
|
|
$this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy|custom outbound]:time:URL');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$domains = explode(',', $domains);
|
|
|
|
@@ -2250,7 +2283,7 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
if (!empty($domains)) {
|
|
|
|
|
$conf = $this->getPacConf();
|
|
|
|
|
foreach ($domains as $k => $v) {
|
|
|
|
|
$conf[$type][idn_to_ascii(trim($v))] = true;
|
|
|
|
|
$conf[$type][$type == 'rulessetlist' ? trim($v) : idn_to_ascii(trim($v))] = true;
|
|
|
|
|
}
|
|
|
|
|
ksort($conf[$type]);
|
|
|
|
|
$this->setPacConf($conf);
|
|
|
|
@@ -3383,11 +3416,26 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function appOutbound()
|
|
|
|
|
{
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
$p['app_outbound'] = !$p['app_outbound'];
|
|
|
|
|
$p = $this->setPacConf($p);
|
|
|
|
|
$this->xtlsapp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function xtlsapp($page = 0)
|
|
|
|
|
{
|
|
|
|
|
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list';
|
|
|
|
|
|
|
|
|
|
$data = $this->listPac('packagelist', $page, 'xtlsapp');
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => 'set to ' . ($p['app_outbound'] ? 'proxy' : 'direct'),
|
|
|
|
|
'callback_data' => "/appOutbound",
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('back'),
|
|
|
|
@@ -3440,11 +3488,11 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . idn_to_utf8($k),
|
|
|
|
|
'callback_data' => "/change$type $i",
|
|
|
|
|
'callback_data' => "/change$type " . ($i + $page * $this->limit),
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => 'delete',
|
|
|
|
|
'callback_data' => "/delete$type $i",
|
|
|
|
|
'callback_data' => "/delete$type " . ($i + $page * $this->limit),
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
$i++;
|
|
|
|
@@ -3662,7 +3710,7 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
[
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('chat'),
|
|
|
|
|
'url' => "https://t.me/vpnbot_group",
|
|
|
|
|
'url' => "https://t.me/+BYuWVd36cZYwNTMy",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('donate'),
|
|
|
|
@@ -3711,17 +3759,28 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function geodb()
|
|
|
|
|
{
|
|
|
|
|
$this->answer($this->input['callback_id'], 'in developing...');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function linkXray($i)
|
|
|
|
|
public function linkXray($i, $s = false)
|
|
|
|
|
{
|
|
|
|
|
$c = $this->getXray();
|
|
|
|
|
$pac = $this->getPacConf();
|
|
|
|
|
$domain = $pac['domain'] ?: $this->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";
|
|
|
|
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
|
|
|
|
$hash = substr(md5($this->key), 0, 8);
|
|
|
|
|
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
|
|
|
|
'h' => $hash,
|
|
|
|
|
't' => 'si',
|
|
|
|
|
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
switch ($s) {
|
|
|
|
|
case 1:
|
|
|
|
|
return "$scheme://{$domain}/pac?h=$hash&t=s&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}";
|
|
|
|
|
case 2:
|
|
|
|
|
return "sing-box://import-remote-profile/?url={$si}#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
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#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dockerApi($url, $method = 'GET', $data = [])
|
|
|
|
@@ -4146,18 +4205,32 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
$this->generateSecretXray();
|
|
|
|
|
}
|
|
|
|
|
$c = $this->getXray();
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
$text[] = "Menu -> " . $this->i18n('xray');
|
|
|
|
|
$text[] = "fake domain: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}</code>";
|
|
|
|
|
$text[] = 'transport: ' . ($p['transport'] ?: 'Reality');
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('changeFakeDomain'),
|
|
|
|
|
'callback_data' => "/changeFakeDomain",
|
|
|
|
|
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] != 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
|
|
|
|
'callback_data' => "/changeTransport",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('selfFakeDomain'),
|
|
|
|
|
'callback_data' => "/selfFakeDomain",
|
|
|
|
|
'text' => $this->i18n('Websocket') . ' ' . ($p['transport'] == 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
|
|
|
|
'callback_data' => "/changeTransport 1",
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
if ($p['transport'] != 'Websocket') {
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('changeFakeDomain'),
|
|
|
|
|
'callback_data' => "/changeFakeDomain",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('selfFakeDomain'),
|
|
|
|
|
'callback_data' => "/selfFakeDomain",
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('v2ray templates'),
|
|
|
|
@@ -4312,6 +4385,7 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
{
|
|
|
|
|
$text[] = "Menu -> " . $this->i18n('warp');
|
|
|
|
|
$text[] = "status: " . $this->warpStatus();
|
|
|
|
|
$text[] = "key: " . $this->getPacConf()['warp'];
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('set key'),
|
|
|
|
@@ -4441,9 +4515,17 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
];
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('show QR'),
|
|
|
|
|
'text' => $this->i18n('qr short'),
|
|
|
|
|
'callback_data' => "/qrXray $i",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('qr v2ray'),
|
|
|
|
|
'callback_data' => "/qrXray {$i}_1",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('qr singbox'),
|
|
|
|
|
'callback_data' => "/qrXray {$i}_2",
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
$data[] = [
|
|
|
|
|
[
|
|
|
|
@@ -4589,10 +4671,41 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
switch ($_GET['t']) {
|
|
|
|
|
case 's':
|
|
|
|
|
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
|
|
|
|
$c['outbounds'][0]['settings']['vnext'][0]['users'][0]['id'] = $uid;
|
|
|
|
|
$c['outbounds'][0]['streamSettings']['realitySettings']['serverName'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
|
|
|
|
$c['outbounds'][0]['streamSettings']['realitySettings']['publicKey'] = $pac['xray'];
|
|
|
|
|
$c['outbounds'][0]['streamSettings']['realitySettings']['shortId'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
|
|
|
|
$c['outbounds'][0]['settings']['vnext'][0]['users'][0] = [
|
|
|
|
|
'id' => $uid,
|
|
|
|
|
'encryption' => 'none',
|
|
|
|
|
];
|
|
|
|
|
if ($pac['transport'] == 'Websocket') {
|
|
|
|
|
$c['outbounds'][0]['streamSettings'] = [
|
|
|
|
|
"network" => "ws",
|
|
|
|
|
"security" => "tls",
|
|
|
|
|
"wsSettings" => [
|
|
|
|
|
"path" => "/ws?ed=2560"
|
|
|
|
|
],
|
|
|
|
|
"tlsSettings" => [
|
|
|
|
|
"allowInsecure" => false,
|
|
|
|
|
"serverName" => $domain,
|
|
|
|
|
"fingerprint" => "chrome"
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
unset($c['outbounds'][0]['mux']);
|
|
|
|
|
} else {
|
|
|
|
|
$c['outbounds'][0]['settings']['vnext'][0]['users'][0]["flow"] = "xtls-rprx-vision";
|
|
|
|
|
$c['outbounds'][0]['streamSettings'] = [
|
|
|
|
|
"network" => "tcp",
|
|
|
|
|
"security" => "reality",
|
|
|
|
|
"realitySettings" => [
|
|
|
|
|
"serverName" => $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0],
|
|
|
|
|
"fingerprint" => "chrome",
|
|
|
|
|
"publicKey" => $pac['xray'],
|
|
|
|
|
"shortId" => $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0],
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
$c['outbounds'][0]['mux'] = [
|
|
|
|
|
"enabled" => false,
|
|
|
|
|
"concurrency" => -1
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($c['routing']['rules'] as $k => $v) {
|
|
|
|
|
if (array_key_exists('domain', $v) && $v['domain'] == '~pac~') {
|
|
|
|
@@ -4609,11 +4722,24 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
$c['dns']['servers'][0]['address'] = "tls://" . ($pac['adguardkey'] ? "{$pac['adguardkey']}." : '') . "$domain";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$c['outbounds'][0]['server'] = $domain;
|
|
|
|
|
$c['outbounds'][0]['uuid'] = $uid;
|
|
|
|
|
$c['outbounds'][0]['tls']['reality']['public_key'] = $pac['xray'];
|
|
|
|
|
$c['outbounds'][0]['tls']['server_name'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
|
|
|
|
$c['outbounds'][0]['tls']['reality']['short_id'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
|
|
|
|
$c['outbounds'][0]['server'] = $domain;
|
|
|
|
|
$c['outbounds'][0]['uuid'] = $uid;
|
|
|
|
|
if ($pac['transport'] == 'Websocket') {
|
|
|
|
|
unset($c['outbounds'][0]['tls']['reality']);
|
|
|
|
|
unset($c['outbounds'][0]['flow']);
|
|
|
|
|
$c['outbounds'][0]["transport"] = [
|
|
|
|
|
"type" => "ws",
|
|
|
|
|
"path" => "/ws"
|
|
|
|
|
];
|
|
|
|
|
$c['outbounds'][0]['tls']['server_name'] = $domain;
|
|
|
|
|
} else {
|
|
|
|
|
unset($c['outbounds'][0]["transport"]);
|
|
|
|
|
$c['outbounds'][0]['flow'] = 'xtls-rprx-vision';
|
|
|
|
|
$c['outbounds'][0]['tls']['reality']['public_key'] = $pac['xray'];
|
|
|
|
|
$c['outbounds'][0]['tls']['server_name'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
|
|
|
|
$c['outbounds'][0]['tls']['reality']['short_id'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($c['route']['rules'] as $k => $v) {
|
|
|
|
|
if (array_key_exists('domain_suffix', $v) && $v['domain_suffix'] == '~pac~') {
|
|
|
|
|
$c['route']['rules'][$k]['domain_suffix'] = array_keys(array_filter($pac['includelist'] ?: []));
|
|
|
|
@@ -4641,21 +4767,18 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
unset($route['rules'][$k]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$route['rules'] = array_values($route['rules']);
|
|
|
|
|
return $route;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addPackageRule($route)
|
|
|
|
|
{
|
|
|
|
|
foreach ($route['rules'] as $k => $v) {
|
|
|
|
|
$t[$v['outbound']] = $k;
|
|
|
|
|
}
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
if (!empty($p['packagelist'])) {
|
|
|
|
|
foreach ($p['packagelist'] as $k => $v) {
|
|
|
|
|
if (!empty($v)) {
|
|
|
|
|
$route['rules'][$t['proxy']]['package_name'][] = $k;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!empty($t = array_filter($p['packagelist'] ?: []))) {
|
|
|
|
|
$route['rules'][] = [
|
|
|
|
|
'package_name' => array_keys($t),
|
|
|
|
|
'outbound' => $p['app_outbound'] ? 'direct' : 'proxy',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return $route;
|
|
|
|
|
}
|
|
|
|
@@ -4776,6 +4899,8 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] = $shortId;
|
|
|
|
|
$pac = $this->getPacConf();
|
|
|
|
|
$pac['xray'] = $public;
|
|
|
|
|
$pac['reality']['shortId'] = $shortId;
|
|
|
|
|
$pac['reality']['privateKey'] = $$p['reality']['shortId'];
|
|
|
|
|
$this->setPacConf($pac);
|
|
|
|
|
$this->restartXray($c);
|
|
|
|
|
}
|
|
|
|
@@ -5061,7 +5186,7 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
{
|
|
|
|
|
exec('git -C / fetch');
|
|
|
|
|
$conf = $this->getPacConf();
|
|
|
|
|
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\nnp.{$conf['domain']}\noc.{$conf['domain']}" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']}" : '') : $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)" : '') . ($conf['subdomain'] ? "\n{$conf['subdomain']}.{$conf['domain']} (custom)" : '') : $this->i18n('domain explain');
|
|
|
|
|
$ssl = $this->expireCert();
|
|
|
|
|
$text[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) : 'none') : '';
|
|
|
|
|
|
|
|
|
@@ -5071,6 +5196,10 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
'text' => $conf['domain'] ? "{$this->i18n('delete')} {$conf['domain']}" : $this->i18n('install domain'),
|
|
|
|
|
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text' => $this->i18n('subdomain') . ($conf['subdomain'] ? ": {$conf['subdomain']}" : ''),
|
|
|
|
|
'callback_data' => '/addSubdomain',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
if ($conf['domain']) {
|
|
|
|
@@ -5349,8 +5478,12 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
public function setFakeDomain($domain, $self = false)
|
|
|
|
|
{
|
|
|
|
|
$c = $this->getXray();
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] = $domain;
|
|
|
|
|
$c['inbounds'][0]['streamSettings']['realitySettings']['dest'] = $self ? "10.10.1.2:443" : "$domain:443";
|
|
|
|
|
$p['reality']['domain'] = $domain;
|
|
|
|
|
$p['reality']['destination'] = $self ? "10.10.1.2:443" : "$domain:443";
|
|
|
|
|
$this->setPacConf($p);
|
|
|
|
|
$this->restartXray($c);
|
|
|
|
|
$this->setUpstreamDomain($domain);
|
|
|
|
|
$this->xray();
|
|
|
|
@@ -5366,6 +5499,57 @@ DNS-over-HTTPS with IP:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function changeTransport($ws = null)
|
|
|
|
|
{
|
|
|
|
|
$p = $this->getPacConf();
|
|
|
|
|
$x = $this->getXray();
|
|
|
|
|
$p['transport'] = $ws ? 'Websocket' : 'Reality';
|
|
|
|
|
if (!empty($ws)) {
|
|
|
|
|
$p['reality']['domain'] = $x['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
|
|
|
|
$p['reality']['destination'] = $x['inbounds'][0]['streamSettings']['realitySettings']['dest'];
|
|
|
|
|
$p['reality']['shortId'] = $x['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
|
|
|
|
foreach ($x['inbounds'][0]['settings']['clients'] as $k => $v) {
|
|
|
|
|
unset($x['inbounds'][0]['settings']['clients'][$k]['flow']);
|
|
|
|
|
}
|
|
|
|
|
$x['inbounds'][0]['streamSettings'] = [
|
|
|
|
|
"network" => "ws",
|
|
|
|
|
"wsSettings" => [
|
|
|
|
|
"path" => "/ws"
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($x['inbounds'][0]['settings']['clients'] as $k => $v) {
|
|
|
|
|
$x['inbounds'][0]['settings']['clients'][$k]['flow'] = 'xtls-rprx-vision';
|
|
|
|
|
}
|
|
|
|
|
$x['inbounds'][0]['streamSettings'] = [
|
|
|
|
|
"network" => "tcp",
|
|
|
|
|
"realitySettings" => [
|
|
|
|
|
"dest" => $p['reality']['destination'],
|
|
|
|
|
"maxClientVer" => "",
|
|
|
|
|
"maxTimeDiff" => 0,
|
|
|
|
|
"minClientVer" => "",
|
|
|
|
|
"privateKey" => $p['reality']['privateKey'],
|
|
|
|
|
"serverNames" => [
|
|
|
|
|
$p['reality']['domain']
|
|
|
|
|
],
|
|
|
|
|
"shortIds" => [$p['reality']['shortId']],
|
|
|
|
|
"show" => false,
|
|
|
|
|
"xver" => 0
|
|
|
|
|
],
|
|
|
|
|
"tcpSettings" => [
|
|
|
|
|
"acceptProxyProtocol" => true
|
|
|
|
|
],
|
|
|
|
|
"sockopt" => [
|
|
|
|
|
"acceptProxyProtocol" => true
|
|
|
|
|
],
|
|
|
|
|
"security" => "reality"
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$this->setPacConf($p);
|
|
|
|
|
$this->restartXray($x);
|
|
|
|
|
$this->xray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setBackup($text)
|
|
|
|
|
{
|
|
|
|
|
$text = trim($text);
|
|
|
|
|