Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 795c357897 | |||
| e172868f39 | |||
| 4ef38775b0 | |||
| abdb4d791a | |||
| 6948239144 | |||
| ff0fd177c7 | |||
| 28e66d46fd | |||
| edee9c78c5 | |||
| 6ad8b3aa92 | |||
| 31f1825d37 | |||
| 10d84da53e | |||
| c7cc0f31ad | |||
| e3ddb642d7 | |||
| 589823e45d | |||
| 0364188fe8 | |||
| 72edcc4757 | |||
| 5988c4fcee |
+217
-38
@@ -133,12 +133,18 @@ class Bot
|
|||||||
case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m):
|
case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m):
|
||||||
$this->changeWG($m[1]);
|
$this->changeWG($m[1]);
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/changeTransport(?: (\d+))?$~', $this->input['callback'], $m):
|
||||||
|
$this->changeTransport($m[1] ?: false);
|
||||||
|
break;
|
||||||
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('~^/appOutbound$~', $this->input['callback'], $m):
|
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
|
||||||
$this->appOutbound();
|
$this->appOutbound();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/addSubdomain$~', $this->input['callback'], $m):
|
||||||
|
$this->addSubdomain();
|
||||||
|
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;
|
||||||
@@ -1095,7 +1101,7 @@ class Bot
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
require __DIR__ . '/config.php';
|
require __DIR__ . '/config.php';
|
||||||
if (!empty($c['admin']) && (empty($this->time2) || ((time() - $this->time2) > 3600))) {
|
if (!empty($c['admin']) && date('H') == 12 && (empty($this->time2) || ((time() - $this->time2) > 4600))) {
|
||||||
$this->time2 = time();
|
$this->time2 = time();
|
||||||
$cert = $this->expireCert();
|
$cert = $this->expireCert();
|
||||||
if (!empty($cert) && $cert - 60 * 60 * 24 * 14 < time()) {
|
if (!empty($cert) && $cert - 60 * 60 * 24 * 14 < time()) {
|
||||||
@@ -1350,7 +1356,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->setUpstreamDomain($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
|
||||||
if (!empty($json['oc'])) {
|
if (!empty($json['oc'])) {
|
||||||
@@ -1369,7 +1375,7 @@ class Bot
|
|||||||
|
|
||||||
$t = file_get_contents('/config/nginx_default.conf');
|
$t = file_get_contents('/config/nginx_default.conf');
|
||||||
if (!empty($json['pac']['domain'])) {
|
if (!empty($json['pac']['domain'])) {
|
||||||
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
|
$t = preg_replace('/server_name ([^\n]+)?/', "server_name *.{$json['pac']['domain']} {$json['pac']['domain']};", $t);
|
||||||
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||||
foreach ($m[0] as $k => $v) {
|
foreach ($m[0] as $k => $v) {
|
||||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||||
@@ -1690,7 +1696,7 @@ class Bot
|
|||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$conf['domain'] = idn_to_ascii($domain);
|
$conf['domain'] = idn_to_ascii($domain);
|
||||||
$nginx = file_get_contents('/config/nginx.conf');
|
$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);
|
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||||
foreach ($m[0] as $k => $v) {
|
foreach ($m[0] as $k => $v) {
|
||||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||||
@@ -1800,9 +1806,13 @@ class Bot
|
|||||||
case 'letsencrypt':
|
case 'letsencrypt':
|
||||||
$out[] = 'Install certificate:';
|
$out[] = 'Install certificate:';
|
||||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||||
$adguardClient = $this->getPacConf()['adguardkey'];
|
$adguardClient = $conf['adguardkey'] ? "-d {$conf['adguardkey']}.{$conf['domain']}" : '';
|
||||||
$adguardClient = $adguardClient ? "-d $adguardClient.{$conf['domain']}" : '';
|
if (!empty($conf['subdomain'])) {
|
||||||
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);
|
foreach ($conf['subdomain'] as $v) {
|
||||||
|
$custom .= " -d $v";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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) {
|
if ($code > 0) {
|
||||||
$this->send($this->input['chat'], "ERROR\n" . implode("\n", $out));
|
$this->send($this->input['chat'], "ERROR\n" . implode("\n", $out));
|
||||||
break;
|
break;
|
||||||
@@ -2051,6 +2061,30 @@ class Bot
|
|||||||
'args' => [],
|
'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'] = array_filter(explode(',', $text), fn($e) => !empty(trim($e)));
|
||||||
|
$this->setPacConf($c);
|
||||||
|
$this->menu('config');
|
||||||
|
}
|
||||||
|
|
||||||
public function enterPage()
|
public function enterPage()
|
||||||
{
|
{
|
||||||
$r = $this->send(
|
$r = $this->send(
|
||||||
@@ -3680,7 +3714,7 @@ DNS-over-HTTPS with IP:
|
|||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('chat'),
|
'text' => $this->i18n('chat'),
|
||||||
'url' => "https://t.me/vpnbot_group",
|
'url' => "https://t.me/+BYuWVd36cZYwNTMy",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('donate'),
|
'text' => $this->i18n('donate'),
|
||||||
@@ -3741,14 +3775,22 @@ DNS-over-HTTPS with IP:
|
|||||||
't' => 'si',
|
't' => 'si',
|
||||||
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
||||||
]));
|
]));
|
||||||
|
$v2 = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 's',
|
||||||
|
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
||||||
|
]));
|
||||||
|
|
||||||
switch ($s) {
|
switch ($s) {
|
||||||
case 1:
|
case 1:
|
||||||
return "$scheme://{$domain}/pac?h=$hash&t=s&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}";
|
return "v2rayng://install-config?url=$v2#{$c['inbounds'][0]['settings']['clients'][$i]['id']}";
|
||||||
case 2:
|
case 2:
|
||||||
return "sing-box://import-remote-profile/?url={$si}#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
return "sing-box://import-remote-profile/?url={$si}#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if ($pac['transport'] == 'Websocket') {
|
||||||
|
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?flow=&path=%2Fws&security=tls&sni=$domain&fp=chrome&type=ws#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
||||||
|
}
|
||||||
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']}";
|
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']}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3985,11 +4027,15 @@ DNS-over-HTTPS with IP:
|
|||||||
public function addxrus($user)
|
public function addxrus($user)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
|
$p = $this->getPacConf();
|
||||||
$uuid = trim($this->ssh('xray uuid', 'xr'));
|
$uuid = trim($this->ssh('xray uuid', 'xr'));
|
||||||
$c['inbounds'][0]['settings']['clients'][] = [
|
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] == 'Websocket' ? [
|
||||||
'id' => $uuid,
|
'id' => $uuid,
|
||||||
'flow' => 'xtls-rprx-vision',
|
'email' => $user,
|
||||||
'email' => $user,
|
] : [
|
||||||
|
'id' => $uuid,
|
||||||
|
'flow' => 'xtls-rprx-vision',
|
||||||
|
'email' => $user,
|
||||||
];
|
];
|
||||||
$this->restartXray($c);
|
$this->restartXray($c);
|
||||||
$this->userXr(count($c['inbounds'][0]['settings']['clients']) - 1);
|
$this->userXr(count($c['inbounds'][0]['settings']['clients']) - 1);
|
||||||
@@ -4175,18 +4221,34 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->generateSecretXray();
|
$this->generateSecretXray();
|
||||||
}
|
}
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
|
$p = $this->getPacConf();
|
||||||
$text[] = "Menu -> " . $this->i18n('xray');
|
$text[] = "Menu -> " . $this->i18n('xray');
|
||||||
$text[] = "fake domain: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}</code>";
|
if (!empty($fake = $c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0])) {
|
||||||
|
$text[] = "fake domain: <code>$fake</code>";
|
||||||
|
}
|
||||||
|
$text[] = 'transport: ' . ($p['transport'] ?: 'Reality');
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('changeFakeDomain'),
|
'text' => $this->i18n('Reality') . ' ' . ($p['transport'] != 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
||||||
'callback_data' => "/changeFakeDomain",
|
'callback_data' => "/changeTransport",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('selfFakeDomain'),
|
'text' => $this->i18n('Websocket') . ' ' . ($p['transport'] == 'Websocket' ? $this->i18n('on') : $this->i18n('off')),
|
||||||
'callback_data' => "/selfFakeDomain",
|
'callback_data' => "/changeTransport 1",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
if ($p['transport'] != 'Websocket') {
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('changeFakeDomain'),
|
||||||
|
'callback_data' => "/changeFakeDomain",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('selfFakeDomain'),
|
||||||
|
'callback_data' => "/selfFakeDomain",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('v2ray templates'),
|
'text' => $this->i18n('v2ray templates'),
|
||||||
@@ -4341,6 +4403,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$text[] = "Menu -> " . $this->i18n('warp');
|
$text[] = "Menu -> " . $this->i18n('warp');
|
||||||
$text[] = "status: " . $this->warpStatus();
|
$text[] = "status: " . $this->warpStatus();
|
||||||
|
$text[] = "key: " . $this->getPacConf()['warp'];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('set key'),
|
'text' => $this->i18n('set key'),
|
||||||
@@ -4424,7 +4487,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
|
|
||||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
||||||
$text[] = "<code>{$this->linkXray($i)}</code>\n";
|
$text[] = "<pre><code>{$this->linkXray($i)}</code></pre>\n";
|
||||||
|
|
||||||
$text[] = "import subscribe:";
|
$text[] = "import subscribe:";
|
||||||
$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=s&r=v&s={$c['id']}#{$c['email']}'>v2rayng</a>";
|
||||||
@@ -4432,8 +4495,8 @@ DNS-over-HTTPS with IP:
|
|||||||
$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[] = "\nv2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code>";
|
$text[] = "\nv2ray config: <pre><code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code></pre>";
|
||||||
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code>";
|
$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[] = [
|
||||||
@@ -4575,19 +4638,23 @@ DNS-over-HTTPS with IP:
|
|||||||
't' => 'si',
|
't' => 'si',
|
||||||
's' => $uid,
|
's' => $uid,
|
||||||
]));
|
]));
|
||||||
$v2 = "$scheme://{$domain}/pac?h=$hash&t=s&s=$uid";
|
$v2 = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 's',
|
||||||
|
's' => $uid,
|
||||||
|
]));
|
||||||
switch ($_GET['r']) {
|
switch ($_GET['r']) {
|
||||||
case 'si':
|
case 'si':
|
||||||
header("Location: sing-box://import-remote-profile/?url=" . $si);
|
header("Location: sing-box://import-remote-profile/?url=$si");
|
||||||
exit;
|
exit;
|
||||||
case 'st':
|
case 'st':
|
||||||
header("Location: streisand://import/$v2");
|
header("Location: streisand://import/$v2");
|
||||||
exit;
|
exit;
|
||||||
case 'v':
|
case 'v':
|
||||||
header("Location: v2rayng://install-config?url=" . urlencode($v2));
|
header("Location: v2rayng://install-config?url=$v2");
|
||||||
exit;
|
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');
|
||||||
@@ -4625,11 +4692,42 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
switch ($_GET['t']) {
|
switch ($_GET['t']) {
|
||||||
case 's':
|
case 's':
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $_GET['cdn'] ?: $domain;
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['users'][0]['id'] = $uid;
|
$c['outbounds'][0]['settings']['vnext'][0]['users'][0] = [
|
||||||
$c['outbounds'][0]['streamSettings']['realitySettings']['serverName'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
'id' => $uid,
|
||||||
$c['outbounds'][0]['streamSettings']['realitySettings']['publicKey'] = $pac['xray'];
|
'encryption' => 'none',
|
||||||
$c['outbounds'][0]['streamSettings']['realitySettings']['shortId'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
];
|
||||||
|
if ($pac['transport'] == 'Websocket') {
|
||||||
|
$c['outbounds'][0]['streamSettings'] = [
|
||||||
|
"network" => "ws",
|
||||||
|
"security" => "tls",
|
||||||
|
"wsSettings" => [
|
||||||
|
"path" => "/ws?ed=2560"
|
||||||
|
],
|
||||||
|
"tlsSettings" => [
|
||||||
|
"allowInsecure" => false,
|
||||||
|
"serverName" => $_GET['cdn'] ?: $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) {
|
foreach ($c['routing']['rules'] as $k => $v) {
|
||||||
if (array_key_exists('domain', $v) && $v['domain'] == '~pac~') {
|
if (array_key_exists('domain', $v) && $v['domain'] == '~pac~') {
|
||||||
@@ -4646,11 +4744,24 @@ DNS-over-HTTPS with IP:
|
|||||||
$c['dns']['servers'][0]['address'] = "tls://" . ($pac['adguardkey'] ? "{$pac['adguardkey']}." : '') . "$domain";
|
$c['dns']['servers'][0]['address'] = "tls://" . ($pac['adguardkey'] ? "{$pac['adguardkey']}." : '') . "$domain";
|
||||||
}
|
}
|
||||||
|
|
||||||
$c['outbounds'][0]['server'] = $domain;
|
$c['outbounds'][0]['server'] = $_GET['cdn'] ?: $domain;
|
||||||
$c['outbounds'][0]['uuid'] = $uid;
|
$c['outbounds'][0]['uuid'] = $uid;
|
||||||
$c['outbounds'][0]['tls']['reality']['public_key'] = $pac['xray'];
|
if ($pac['transport'] == 'Websocket') {
|
||||||
$c['outbounds'][0]['tls']['server_name'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0];
|
unset($c['outbounds'][0]['tls']['reality']);
|
||||||
$c['outbounds'][0]['tls']['reality']['short_id'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
unset($c['outbounds'][0]['flow']);
|
||||||
|
$c['outbounds'][0]["transport"] = [
|
||||||
|
"type" => "ws",
|
||||||
|
"path" => "/ws"
|
||||||
|
];
|
||||||
|
$c['outbounds'][0]['tls']['server_name'] = $_GET['cdn'] ?: $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) {
|
foreach ($c['route']['rules'] as $k => $v) {
|
||||||
if (array_key_exists('domain_suffix', $v) && $v['domain_suffix'] == '~pac~') {
|
if (array_key_exists('domain_suffix', $v) && $v['domain_suffix'] == '~pac~') {
|
||||||
$c['route']['rules'][$k]['domain_suffix'] = array_keys(array_filter($pac['includelist'] ?: []));
|
$c['route']['rules'][$k]['domain_suffix'] = array_keys(array_filter($pac['includelist'] ?: []));
|
||||||
@@ -4810,6 +4921,8 @@ DNS-over-HTTPS with IP:
|
|||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] = $shortId;
|
$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] = $shortId;
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$pac['xray'] = $public;
|
$pac['xray'] = $public;
|
||||||
|
$pac['reality']['shortId'] = $shortId;
|
||||||
|
$pac['reality']['privateKey'] = $private;
|
||||||
$this->setPacConf($pac);
|
$this->setPacConf($pac);
|
||||||
$this->restartXray($c);
|
$this->restartXray($c);
|
||||||
}
|
}
|
||||||
@@ -5094,8 +5207,14 @@ DNS-over-HTTPS with IP:
|
|||||||
public function configMenu()
|
public function configMenu()
|
||||||
{
|
{
|
||||||
exec('git -C / fetch');
|
exec('git -C / fetch');
|
||||||
$conf = $this->getPacConf();
|
$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');
|
if (!empty($conf['subdomain'])) {
|
||||||
|
$custom = "\ncustom:\n";
|
||||||
|
foreach ($conf['subdomain'] as $v) {
|
||||||
|
$custom .= "$v\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$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()) : 'none') : '';
|
||||||
|
|
||||||
@@ -5105,6 +5224,10 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => $conf['domain'] ? "{$this->i18n('delete')} {$conf['domain']}" : $this->i18n('install domain'),
|
'text' => $conf['domain'] ? "{$this->i18n('delete')} {$conf['domain']}" : $this->i18n('install domain'),
|
||||||
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('subdomain'),
|
||||||
|
'callback_data' => '/addSubdomain',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
if ($conf['domain']) {
|
if ($conf['domain']) {
|
||||||
@@ -5383,8 +5506,12 @@ DNS-over-HTTPS with IP:
|
|||||||
public function setFakeDomain($domain, $self = false)
|
public function setFakeDomain($domain, $self = false)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
|
$p = $this->getPacConf();
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] = $domain;
|
$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] = $domain;
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['dest'] = $self ? "10.10.1.2:443" : "$domain:443";
|
$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->restartXray($c);
|
||||||
$this->setUpstreamDomain($domain);
|
$this->setUpstreamDomain($domain);
|
||||||
$this->xray();
|
$this->xray();
|
||||||
@@ -5400,6 +5527,58 @@ 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']['domain'];
|
||||||
|
$p['reality']['destination'] = $x['inbounds'][0]['streamSettings']['realitySettings']['dest'] ?: $p['reality']['destination'];
|
||||||
|
$p['reality']['shortId'] = $x['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] ?: $p['reality']['shortId'];
|
||||||
|
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'] ?: $x['inbounds'][0]['streamSettings']['realitySettings']['dest'],
|
||||||
|
"maxClientVer" => "",
|
||||||
|
"maxTimeDiff" => 0,
|
||||||
|
"minClientVer" => "",
|
||||||
|
"privateKey" => $p['reality']['privateKey'],
|
||||||
|
"serverNames" => [
|
||||||
|
$p['reality']['domain'] ?: $x['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]
|
||||||
|
],
|
||||||
|
"shortIds" => [$p['reality']['shortId']] ?: $x['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0],
|
||||||
|
"show" => false,
|
||||||
|
"xver" => 0
|
||||||
|
],
|
||||||
|
"tcpSettings" => [
|
||||||
|
"acceptProxyProtocol" => true
|
||||||
|
],
|
||||||
|
"sockopt" => [
|
||||||
|
"acceptProxyProtocol" => true
|
||||||
|
],
|
||||||
|
"security" => "reality"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$this->setUpstreamDomain($ws ? 't' : ($p['reality']['domain'] ?: $x['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]));
|
||||||
|
$this->setPacConf($p);
|
||||||
|
$this->restartXray($x);
|
||||||
|
$this->xray();
|
||||||
|
}
|
||||||
|
|
||||||
public function setBackup($text)
|
public function setBackup($text)
|
||||||
{
|
{
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
@@ -5544,7 +5723,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'] = ($pac['domain'] ? $pac['domain'] : $this->ip) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
|
||||||
}
|
}
|
||||||
foreach ($peer as $k => $v) {
|
foreach ($peer as $k => $v) {
|
||||||
$conf[] = "$k = $v";
|
$conf[] = "$k = $v";
|
||||||
|
|||||||
+2
-2
@@ -262,8 +262,8 @@ $i = [
|
|||||||
'ru' => 'очистить',
|
'ru' => 'очистить',
|
||||||
],
|
],
|
||||||
'xray' => [
|
'xray' => [
|
||||||
'en' => 'XTLS-Reality',
|
'en' => 'Xray',
|
||||||
'ru' => 'XTLS-Reality',
|
'ru' => 'Xray',
|
||||||
],
|
],
|
||||||
'geodb' => [
|
'geodb' => [
|
||||||
'en' => 'GeoIp/GeoSite',
|
'en' => 'GeoIp/GeoSite',
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ http {
|
|||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
}
|
}
|
||||||
|
location /ws {
|
||||||
|
proxy_pass http://xr:443;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_read_timeout 5d;
|
||||||
|
}
|
||||||
location ~\.well-known {
|
location ~\.well-known {
|
||||||
access_log /logs/nginx_certbot_access;
|
access_log /logs/nginx_certbot_access;
|
||||||
root /certs/;
|
root /certs/;
|
||||||
@@ -124,6 +135,17 @@ http {
|
|||||||
# proxy_set_header Upgrade $http_upgrade;
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
# proxy_set_header Connection "upgrade";
|
# proxy_set_header Connection "upgrade";
|
||||||
# }
|
# }
|
||||||
|
# location /ws {
|
||||||
|
# proxy_pass http://xr:443;
|
||||||
|
# proxy_redirect off;
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
|
# proxy_set_header Connection "upgrade";
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
# proxy_read_timeout 5d;
|
||||||
|
# }
|
||||||
#-domain
|
#-domain
|
||||||
#-ssl
|
#-ssl
|
||||||
# # The DoH server block
|
# # The DoH server block
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ http {
|
|||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
}
|
}
|
||||||
|
location /ws {
|
||||||
|
proxy_pass http://xr:443;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_read_timeout 5d;
|
||||||
|
}
|
||||||
location ~\.well-known {
|
location ~\.well-known {
|
||||||
access_log /logs/nginx_certbot_access;
|
access_log /logs/nginx_certbot_access;
|
||||||
root /certs/;
|
root /certs/;
|
||||||
@@ -124,6 +135,17 @@ http {
|
|||||||
# proxy_set_header Upgrade $http_upgrade;
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
# proxy_set_header Connection "upgrade";
|
# proxy_set_header Connection "upgrade";
|
||||||
# }
|
# }
|
||||||
|
# location /ws {
|
||||||
|
# proxy_pass http://xr:443;
|
||||||
|
# proxy_redirect off;
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
|
# proxy_set_header Connection "upgrade";
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
# proxy_read_timeout 5d;
|
||||||
|
# }
|
||||||
#-domain
|
#-domain
|
||||||
#-ssl
|
#-ssl
|
||||||
# # The DoH server block
|
# # The DoH server block
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ b:
|
|||||||
u: # запуск контейнеров
|
u: # запуск контейнеров
|
||||||
bash ./update/update.sh &
|
bash ./update/update.sh &
|
||||||
touch ./override.env
|
touch ./override.env
|
||||||
IP=$(shell curl https://ipinfo.io/ip) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
IP=$(shell curl ipinfo.io/ip) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||||
d: # остановка контейнеров
|
d: # остановка контейнеров
|
||||||
-kill -9 $(shell cat ./update/update_pid) > /dev/null
|
-kill -9 $(shell cat ./update/update_pid) > /dev/null
|
||||||
docker compose down --remove-orphans
|
docker compose down --remove-orphans
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
10.09.2024 v1.53
|
||||||
|
- домен в endpoint для амнезии
|
||||||
|
10.09.2024 v1.52
|
||||||
|
- фикс спамящего уведомления о просрочке сертификата
|
||||||
|
10.09.2024 v1.51
|
||||||
|
- фикс ipinfo
|
||||||
|
08.09.2024 v1.50
|
||||||
|
- fix import with transport
|
||||||
|
08.09.2024 v1.49
|
||||||
|
- fix add user xray with transport
|
||||||
|
08.09.2024 v1.48
|
||||||
|
- fix change xray transport, save private key xray
|
||||||
|
08.09.2024 v1.47
|
||||||
|
- fix websocket -> reality
|
||||||
|
03.09.2024 v1.46.2
|
||||||
|
- fix link v2ray
|
||||||
|
03.09.2024 v1.46.1
|
||||||
|
- fix import
|
||||||
|
- fix websocket domain
|
||||||
|
03.09.2024 v1.46
|
||||||
|
- возможность добавить кастомный поддомен для Letsencrypt
|
||||||
|
03.09.2024 v1.45
|
||||||
|
- выбор транспорта reality/websocket
|
||||||
26.08.2024 v1.44
|
26.08.2024 v1.44
|
||||||
- qr для xtls
|
- qr для xtls
|
||||||
- фикс действий на элементом списков
|
- фикс действий на элементом списков
|
||||||
|
|||||||
Reference in New Issue
Block a user