Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ece8fb75d5 | |||
| 75c0a6a294 | |||
| 9e2b0c041a | |||
| 108a048f5a | |||
| a6ec5b041c | |||
| f55bf31c07 | |||
| b5a40fa0cc | |||
| 7e79f591c3 | |||
| 12babef21e | |||
| b6e078adc0 | |||
| 31a5415e1f | |||
| 7df97c6ca1 | |||
| 638fcf35d7 | |||
| 07022b1697 | |||
| f2bfad7c80 | |||
| 4d6f59bc06 | |||
| fe42515617 | |||
| 7e05806f6e | |||
| 149ce068bf | |||
| 144366ce9d | |||
| 12b42d16b9 | |||
| 2d94504aa3 | |||
| d99ddc7ad9 | |||
| a1ac552c3e | |||
| 95c9d40b00 | |||
| af88237ddc | |||
| 102ce5b0a5 | |||
| a72db227f0 | |||
| e52fa68edd | |||
| 8dba00c9f7 | |||
| 381e6a9dba | |||
| 08e001bcb0 | |||
| c5a35e43be | |||
| eb0d0bb59f | |||
| 7316d49af8 | |||
| c1a637ac29 | |||
| 98d1961669 | |||
| 08f0babed6 | |||
| f2897d4b07 | |||
| b728553db5 | |||
| 9742cecf51 | |||
| 2ed3dfb6dd | |||
| 0cc49a89e5 |
+361
-202
@@ -295,6 +295,9 @@ class Bot
|
|||||||
case preg_match('~^/setSSL (\w+)$~', $this->input['callback'], $m):
|
case preg_match('~^/setSSL (\w+)$~', $this->input['callback'], $m):
|
||||||
$this->setSSL($m[1]);
|
$this->setSSL($m[1]);
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/setSingboxType (\w+)$~', $this->input['callback'], $m):
|
||||||
|
$this->setSingboxType($m[1]);
|
||||||
|
break;
|
||||||
case preg_match('~^/lang (\w+)$~', $this->input['callback'], $m):
|
case preg_match('~^/lang (\w+)$~', $this->input['callback'], $m):
|
||||||
$this->setLang($m[1]);
|
$this->setLang($m[1]);
|
||||||
break;
|
break;
|
||||||
@@ -437,9 +440,6 @@ class Bot
|
|||||||
case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m):
|
case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m):
|
||||||
$this->changeFakeDomain();
|
$this->changeFakeDomain();
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/selfFakeDomain$~', $this->input['callback'], $m):
|
|
||||||
$this->selfFakeDomain();
|
|
||||||
break;
|
|
||||||
case preg_match('~^/changeTGDomain$~', $this->input['callback'], $m):
|
case preg_match('~^/changeTGDomain$~', $this->input['callback'], $m):
|
||||||
$this->changeTGDomain();
|
$this->changeTGDomain();
|
||||||
break;
|
break;
|
||||||
@@ -534,12 +534,101 @@ class Bot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restartXray($c)
|
public function restartXray($c = false)
|
||||||
{
|
{
|
||||||
$c['inbounds'][0]['settings']['clients'] = array_values($c['inbounds'][0]['settings']['clients']);
|
$c = $c ?: $this->getXray();
|
||||||
$this->ssh('pkill xray', 'xr');
|
$p = $this->getPacConf();
|
||||||
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
if (!empty($p['xrusers'])) {
|
||||||
$this->ssh('xray run -config /xray.json > /dev/null 2>&1 &', 'xr');
|
$cl = array_filter($p['xrusers'], fn ($e) => empty($e['off']) && (empty($e['time']) || $e['time'] >= time()));
|
||||||
|
}
|
||||||
|
switch ($p['xtlsmode']) {
|
||||||
|
case 'shadow':
|
||||||
|
if (!empty($cl)) {
|
||||||
|
foreach ($cl as $v) {
|
||||||
|
$t[] = [
|
||||||
|
"name" => $v['name'],
|
||||||
|
"password" => $v['uuid'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$c['inbounds'] = [
|
||||||
|
[
|
||||||
|
"type" => "shadowtls",
|
||||||
|
"tag" => "ss-tls-in",
|
||||||
|
"listen" => "0.0.0.0",
|
||||||
|
"detour" => "ss-in",
|
||||||
|
"sniff" => true,
|
||||||
|
"sniff_override_destination" => false,
|
||||||
|
"listen_port" => 443,
|
||||||
|
"version" => 3,
|
||||||
|
"strict_mode" => true,
|
||||||
|
"users" => $t ?: [],
|
||||||
|
"handshake" => [
|
||||||
|
"server" => $p['xray']['domain'],
|
||||||
|
"server_port" => 443,
|
||||||
|
"domain_strategy" => "ipv4_only"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"type" => "shadowsocks",
|
||||||
|
"tag" => "ss-in",
|
||||||
|
"listen" => "127.0.0.1",
|
||||||
|
"network" => "tcp",
|
||||||
|
"sniff" => false,
|
||||||
|
"sniff_override_destination" => false,
|
||||||
|
"method" => "2022-blake3-aes-128-gcm",
|
||||||
|
"password" => $p['xray']['sspwd'],
|
||||||
|
"multiplex" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"padding" => true,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'trojan':
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (!empty($cl)) {
|
||||||
|
foreach ($cl as $v) {
|
||||||
|
$t[] = [
|
||||||
|
"uuid" => $v['uuid'],
|
||||||
|
"flow" => 'xtls-rprx-vision',
|
||||||
|
"name" => $v['name'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$c['inbounds'] = [
|
||||||
|
[
|
||||||
|
"type" => "vless",
|
||||||
|
"tag" => "vless",
|
||||||
|
"listen" => "0.0.0.0",
|
||||||
|
"listen_port" => 443,
|
||||||
|
"sniff" => true,
|
||||||
|
"sniff_override_destination" => false,
|
||||||
|
"users" => $t ?: [],
|
||||||
|
"tls" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"server_name" => $p['xray']['domain'],
|
||||||
|
"reality" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"handshake" => [
|
||||||
|
"server" => $p['xray']['domain'],
|
||||||
|
"server_port" => 443
|
||||||
|
],
|
||||||
|
"private_key" => $p['xray']['private'],
|
||||||
|
"short_id" => [
|
||||||
|
$p['xray']['shortid']
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$this->ssh('pkill sing-box', 'si');
|
||||||
|
file_put_contents('/config/singbox.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||||
|
$this->ssh('sing-box run -c /config/singbox.json > /dev/null 2>&1 &', 'si');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function linkMtproto()
|
public function linkMtproto()
|
||||||
@@ -1172,8 +1261,8 @@ class Bot
|
|||||||
public function shutdownClientXr()
|
public function shutdownClientXr()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$c = $this->getXray();
|
$p = $this->getPacConf();
|
||||||
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
|
foreach ($p['xrusers'] as $k => $v) {
|
||||||
if (!empty($v['time']) && ($v['time'] < time())) {
|
if (!empty($v['time']) && ($v['time'] < time())) {
|
||||||
$this->switchXr($k, 1);
|
$this->switchXr($k, 1);
|
||||||
}
|
}
|
||||||
@@ -1227,7 +1316,6 @@ class Bot
|
|||||||
] : false,
|
] : false,
|
||||||
'mtproto' => file_get_contents('/config/mtprotosecret'),
|
'mtproto' => file_get_contents('/config/mtprotosecret'),
|
||||||
'mtprotodomain' => file_get_contents('/config/mtprotodomain'),
|
'mtprotodomain' => file_get_contents('/config/mtprotodomain'),
|
||||||
'xray' => $this->getXray(),
|
|
||||||
'oc' => file_get_contents('/config/ocserv.conf'),
|
'oc' => file_get_contents('/config/ocserv.conf'),
|
||||||
'ocu' => file_get_contents('/config/ocserv.passwd'),
|
'ocu' => file_get_contents('/config/ocserv.passwd'),
|
||||||
|
|
||||||
@@ -1289,11 +1377,36 @@ class Bot
|
|||||||
if ($this->getPacConf()['wg1_amnezia'] != $json['pac']['wg1_amnezia']) {
|
if ($this->getPacConf()['wg1_amnezia'] != $json['pac']['wg1_amnezia']) {
|
||||||
$switch_wg1amnezia = 1;
|
$switch_wg1amnezia = 1;
|
||||||
}
|
}
|
||||||
|
unset($json['pac']['subzoneslist']);
|
||||||
|
unset($json['pac']['reverselist']);
|
||||||
|
unset($json['pac']['excludelist']);
|
||||||
|
unset($json['pac']['zapret']);
|
||||||
$this->setPacConf($json['pac']);
|
$this->setPacConf($json['pac']);
|
||||||
$out[] = 'update naiveproxy';
|
$out[] = 'update naiveproxy';
|
||||||
$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->restartNaive();
|
$this->restartNaive();
|
||||||
$this->pacUpdate('1');
|
$this->pacUpdate('1');
|
||||||
|
// xray
|
||||||
|
if (!empty($json['xray']['inbounds'][0]['settings']['clients'])) {
|
||||||
|
$out[] = 'migrate xray to singbox';
|
||||||
|
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||||
|
$pac = $this->getPacConf();
|
||||||
|
foreach ($json['xray']['inbounds'][0]['settings']['clients'] as $v) {
|
||||||
|
$pac['xrusers'][] = [
|
||||||
|
'name' => $v['email'],
|
||||||
|
'uuid' => $v['id'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$pac['xray'] = [
|
||||||
|
"domain" => $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] != $pac['domain'] ? $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] : 'vk.com',
|
||||||
|
"public" => $json['pac']['xray'],
|
||||||
|
"private" => $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['privateKey'],
|
||||||
|
"shortid" => $json['xray']['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0],
|
||||||
|
"sspwd" => trim($this->ssh('sing-box generate rand --base64 16', 'si')),
|
||||||
|
];
|
||||||
|
$this->setPacConf($pac);
|
||||||
|
}
|
||||||
|
$this->xrayUpdateRules();
|
||||||
}
|
}
|
||||||
// wg
|
// wg
|
||||||
if (!empty($json['wg'])) {
|
if (!empty($json['wg'])) {
|
||||||
@@ -1345,13 +1458,6 @@ class Bot
|
|||||||
file_put_contents('/config/mtprotodomain', $json['mtprotodomain'] ?: '');
|
file_put_contents('/config/mtprotodomain', $json['mtprotodomain'] ?: '');
|
||||||
$this->restartTG();
|
$this->restartTG();
|
||||||
}
|
}
|
||||||
// xray
|
|
||||||
if (!empty($json['xray'])) {
|
|
||||||
$out[] = 'update xray';
|
|
||||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
|
||||||
$this->restartXray($json['xray']);
|
|
||||||
$this->setUpstreamDomain($json['xray']['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]);
|
|
||||||
}
|
|
||||||
// ocserv
|
// ocserv
|
||||||
if (!empty($json['oc'])) {
|
if (!empty($json['oc'])) {
|
||||||
$out[] = 'update ocserv';
|
$out[] = 'update ocserv';
|
||||||
@@ -2292,43 +2398,19 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$xr = $this->getXray();
|
$xr = $this->getXray();
|
||||||
$xr['outbounds'] = [
|
|
||||||
[
|
|
||||||
"protocol" => "freedom",
|
|
||||||
"tag" => "direct",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"protocol" => "blackhole",
|
|
||||||
"tag" => "block",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"protocol" => "socks",
|
|
||||||
"tag" => "warp",
|
|
||||||
"settings" => [
|
|
||||||
'servers' => [
|
|
||||||
[
|
|
||||||
"address" => "10.10.0.13",
|
|
||||||
"port" => 4000,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
if (!empty($c['blocklist']) && !empty(array_filter($c['blocklist']))) {
|
if (!empty($c['blocklist']) && !empty(array_filter($c['blocklist']))) {
|
||||||
$rules[] = [
|
$rules[] = [
|
||||||
"type" => "field",
|
"outbound" => "block",
|
||||||
"outboundTag" => "block",
|
"domain_suffix" => array_keys(array_filter($c['blocklist'])),
|
||||||
"domain" => array_keys(array_filter($c['blocklist'])),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (!empty($c['warplist']) && !empty(array_filter($c['warplist']))) {
|
if (!empty($c['warplist']) && !empty(array_filter($c['warplist']))) {
|
||||||
$rules[] = [
|
$rules[] = [
|
||||||
"type" => "field",
|
"outbound" => "warp",
|
||||||
"outboundTag" => "warp",
|
"domain_suffix" => array_keys(array_filter($c['warplist'])),
|
||||||
"domain" => array_keys(array_filter($c['warplist'])),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$xr['routing']['rules'] = $rules ?: [];
|
$xr['route']['rules'] = $rules ?: [];
|
||||||
$this->restartXray($xr);
|
$this->restartXray($xr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3739,17 +3821,17 @@ DNS-over-HTTPS with IP:
|
|||||||
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||||
'h' => $hash,
|
'h' => $hash,
|
||||||
't' => 'si',
|
't' => 'si',
|
||||||
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
's' => $pac['xrusers'][$i]['uuid'],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
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 "$scheme://{$domain}/pac?h=$hash&t=s&s={$pac['xrusers'][$i]['uuid']}";
|
||||||
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}#{$pac['xrusers'][$i]['name']}";
|
||||||
|
|
||||||
default:
|
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']}";
|
return "vless://{$pac['xrusers'][$i]['uuid']}@$domain:443?security=reality&sni={$c['inbounds'][0]['tls']['reality']['handshake']['server']}&fp=chrome&pbk={$pac['xray']['public']}&sid={$c['inbounds'][0]['tls']['reality']['short_id'][0]}&type=tcp&flow=xtls-rprx-vision#{$pac['xrusers'][$i]['name']}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3958,14 +4040,10 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function delxr($i)
|
public function delxr($i)
|
||||||
{
|
{
|
||||||
$r = $this->getXray();
|
$p = $this->getPacConf();
|
||||||
foreach ($r['inbounds'][0]['settings']['clients'] as $k => $v) {
|
unset($p['xrusers'][$i]);
|
||||||
if ($i == $k) {
|
$this->setPacConf($p);
|
||||||
unset($r['inbounds'][0]['settings']['clients'][$k]);
|
$this->restartXray();
|
||||||
$this->restartXray($r);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->xray();
|
$this->xray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3984,50 +4062,51 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function addxrus($user)
|
public function addxrus($user)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$uuid = trim($this->ssh('sing-box generate uuid', 'si'));
|
||||||
$uuid = trim($this->ssh('xray uuid', 'xr'));
|
$pac = $this->getPacConf();
|
||||||
$c['inbounds'][0]['settings']['clients'][] = [
|
|
||||||
'id' => $uuid,
|
$pac['xrusers'][] = [
|
||||||
'flow' => 'xtls-rprx-vision',
|
'uuid' => $uuid,
|
||||||
'email' => $user,
|
'flow' => 'xtls-rprx-vision',
|
||||||
|
'name' => $user,
|
||||||
];
|
];
|
||||||
$this->restartXray($c);
|
$this->setPacConf($pac);
|
||||||
$this->userXr(count($c['inbounds'][0]['settings']['clients']) - 1);
|
$this->restartXray($this->getXray());
|
||||||
|
$this->userXr(count($pac['xrusers']) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTimerXr($time, $i)
|
public function setTimerXr($time, $i)
|
||||||
{
|
{
|
||||||
$time = strtotime($time);
|
$c = $this->getPacConf();
|
||||||
if ($time === false) {
|
if ($time === '0') {
|
||||||
$this->send($this->input['chat'], 'wrong format');
|
unset($c['xrusers'][$i]['time']);
|
||||||
return;
|
|
||||||
}
|
|
||||||
$c = $this->getXray();
|
|
||||||
if (empty($time)) {
|
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
|
||||||
} else {
|
} else {
|
||||||
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
$time = strtotime($time);
|
||||||
$this->switchXr($i, 1);
|
if ($time === false) {
|
||||||
$c = $this->getXray();
|
$this->send($this->input['chat'], 'wrong format');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
|
if (!empty($c['xrusers'][$i]['off'])) {
|
||||||
|
unset($c['xrusers'][$i]['off']);
|
||||||
|
}
|
||||||
|
$c['xrusers'][$i]['time'] = $time;
|
||||||
}
|
}
|
||||||
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
$this->setPacConf($c);
|
||||||
|
$this->restartXray();
|
||||||
$this->userXr($i);
|
$this->userXr($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchXr($i, $nm = 0)
|
public function switchXr($i, $nm = 0)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$p = $this->getPacConf();
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
unset($p['xrusers'][$i]['time']);
|
||||||
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
if (empty($p['xrusers'][$i]['off'])) {
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
|
$p['xrusers'][$i]['off'] = 1;
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
|
|
||||||
} else {
|
} else {
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['id'] = $c['inbounds'][0]['settings']['clients'][$i]['off'];
|
unset($p['xrusers'][$i]['off']);
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$i]['off']);
|
|
||||||
}
|
}
|
||||||
$this->restartXray($c);
|
$this->setPacConf($p);
|
||||||
|
$this->restartXray();
|
||||||
if (empty($nm)) {
|
if (empty($nm)) {
|
||||||
$this->userXr($i);
|
$this->userXr($i);
|
||||||
}
|
}
|
||||||
@@ -4035,9 +4114,9 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function renXrUs($name, $i)
|
public function renXrUs($name, $i)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getPacConf();
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['email'] = $name;
|
$c['xrusers'][$i]['name'] = $name;
|
||||||
$this->restartXray($c);
|
$this->setPacConf($c);
|
||||||
$this->userXr($i);
|
$this->userXr($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4091,10 +4170,14 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->templates($type);
|
$this->templates($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadTemplate($type, $name)
|
public function downloadTemplate($type, $name = false)
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$f = new \CURLStringFile(json_encode($pac["{$type}templates"][base64_decode($name)], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), base64_decode($name) . '.json', 'application/json');
|
if (!empty($name)) {
|
||||||
|
$f = new \CURLStringFile(json_encode($pac["{$type}templates"][base64_decode($name)], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), base64_decode($name) . '.json', 'application/json');
|
||||||
|
} else {
|
||||||
|
$f = new \CURLFile("/config/{$type}.json", 'application/json', "$type.json");
|
||||||
|
}
|
||||||
$this->sendFile($this->input['chat'], $f);
|
$this->sendFile($this->input['chat'], $f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4129,6 +4212,10 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => "origin",
|
'text' => "origin",
|
||||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('download'),
|
||||||
|
'callback_data' => "/downloadTemplate $type",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||||
'callback_data' => "/defaultTemplate $type",
|
'callback_data' => "/defaultTemplate $type",
|
||||||
@@ -4169,23 +4256,54 @@ DNS-over-HTTPS with IP:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSingboxType($type)
|
||||||
|
{
|
||||||
|
$p = $this->getPacConf();
|
||||||
|
$p['xtlsmode'] = $type;
|
||||||
|
if (empty($p['xray']['sspwd'])) {
|
||||||
|
$p['xray']['sspwd'] = trim($this->ssh('sing-box generate rand --base64 16', 'si'));
|
||||||
|
}
|
||||||
|
$this->setPacConf($p);
|
||||||
|
$this->restartXray();
|
||||||
|
$this->xray();
|
||||||
|
}
|
||||||
|
|
||||||
public function xray($page = 0)
|
public function xray($page = 0)
|
||||||
{
|
{
|
||||||
if (!$this->ssh('pgrep xray', 'xr')) {
|
$pac = $this->getPacConf();
|
||||||
|
if (!$this->ssh('pgrep sing-box', 'si') || empty($pac['xray']['private'])) {
|
||||||
$this->generateSecretXray();
|
$this->generateSecretXray();
|
||||||
|
$pac = $this->getPacConf();
|
||||||
}
|
}
|
||||||
$c = $this->getXray();
|
|
||||||
$text[] = "Menu -> " . $this->i18n('xray');
|
$text[] = "Menu -> " . $this->i18n('xray');
|
||||||
$text[] = "fake domain: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}</code>";
|
$text[] = "\nfake domain: <code>{$pac['xray']['domain']}</code>";
|
||||||
|
$text[] = "public: <code>{$pac['xray']['public']}</code>";
|
||||||
|
$text[] = "private: <code>{$pac['xray']['private']}</code>";
|
||||||
|
$text[] = "shortId: <code>{$pac['xray']['shortid']}</code>";
|
||||||
|
$text[] = "sspwd: <code>{$pac['xray']['sspwd']}</code>";
|
||||||
$data[] = [
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('generateSecret'),
|
||||||
|
'callback_data' => "/generateSecretXray",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('changeFakeDomain'),
|
'text' => $this->i18n('changeFakeDomain'),
|
||||||
'callback_data' => "/changeFakeDomain",
|
'callback_data' => "/changeFakeDomain",
|
||||||
],
|
],
|
||||||
|
];
|
||||||
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('selfFakeDomain'),
|
'text' => $this->i18n('reality') . ' ' . ((empty($pac['xtlsmode']) || $pac['xtlsmode'] == 'reality') ? '✅' : ''),
|
||||||
'callback_data' => "/selfFakeDomain",
|
'callback_data' => "/setSingboxType reality",
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('shadow') . ' ' . ($pac['xtlsmode'] == 'shadow' ? '✅' : ''),
|
||||||
|
'callback_data' => "/setSingboxType shadow",
|
||||||
|
],
|
||||||
|
// [
|
||||||
|
// 'text' => $this->i18n('trojan') . ' ' . ($pac['xtlsmode'] == 'trojan' ? '✅' : ''),
|
||||||
|
// 'callback_data' => "/setSingboxType trojan",
|
||||||
|
// ],
|
||||||
];
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
@@ -4203,15 +4321,15 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => "/routes",
|
'callback_data' => "/routes",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
|
$cl = $pac['xrusers'] ?: [];
|
||||||
|
foreach ($cl as $k => $v) {
|
||||||
if (!empty($v['off'])) {
|
if (!empty($v['off'])) {
|
||||||
$off++;
|
$off++;
|
||||||
} else {
|
} else {
|
||||||
$on++;
|
$on++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$type = $this->getPacConf()['xtlslist'];
|
$clients = array_filter($cl, fn($e) => !$pac['xtlslist'] ? empty($e['off']) : !empty($e['off']));
|
||||||
$clients = array_filter($c['inbounds'][0]['settings']['clients'], fn($e) => !$type ? empty($e['off']) : !empty($e['off']));
|
|
||||||
uasort($clients, fn($a, $b) => ($a['time'] ?: PHP_INT_MAX) <=> ($b['time'] ?: PHP_INT_MAX));
|
uasort($clients, fn($a, $b) => ($a['time'] ?: PHP_INT_MAX) <=> ($b['time'] ?: PHP_INT_MAX));
|
||||||
|
|
||||||
$all = (int) ceil(count($clients) / $this->limit);
|
$all = (int) ceil(count($clients) / $this->limit);
|
||||||
@@ -4222,7 +4340,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$time = $v['time'] ? $this->getTime($v['time']) : '';
|
$time = $v['time'] ? $this->getTime($v['time']) : '';
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => "{$v['email']}" . ($time ? ": $time" : ''),
|
'text' => "{$v['name']}" . ($time ? ": $time" : ''),
|
||||||
'callback_data' => "/userXr $k",
|
'callback_data' => "/userXr $k",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@@ -4245,11 +4363,11 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => "/addXrUser",
|
'callback_data' => "/addXrUser",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('on') . " $on " . (!$type ? "✅" : ''),
|
'text' => $this->i18n('on') . " $on " . (!$pac['xtlslist'] ? "✅" : ''),
|
||||||
'callback_data' => "/listXr 0",
|
'callback_data' => "/listXr 0",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('off') . " $off " . ($type ? "✅" : ''),
|
'text' => $this->i18n('off') . " $off " . ($pac['xtlslist'] ? "✅" : ''),
|
||||||
'callback_data' => "/listXr 1",
|
'callback_data' => "/listXr 1",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@@ -4365,13 +4483,13 @@ DNS-over-HTTPS with IP:
|
|||||||
public function choiceTemplate($arg)
|
public function choiceTemplate($arg)
|
||||||
{
|
{
|
||||||
$arg = explode('_', $arg);
|
$arg = explode('_', $arg);
|
||||||
$c = $this->getXray();
|
$c = $this->getPacConf();
|
||||||
if (!empty($arg[2])) {
|
if (!empty($arg[2])) {
|
||||||
$c['inbounds'][0]['settings']['clients'][$arg[1]]["{$arg[0]}template"] = $arg[2];
|
$c['xrusers'][$arg[1]]["{$arg[0]}template"] = $arg[2];
|
||||||
} else {
|
} else {
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$arg[1]]["{$arg[0]}template"]);
|
unset($c['xrusers'][$arg[1]]["{$arg[0]}template"]);
|
||||||
}
|
}
|
||||||
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
$this->setPacConf($c);
|
||||||
$this->userXr($arg[1]);
|
$this->userXr($arg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4379,7 +4497,7 @@ DNS-over-HTTPS with IP:
|
|||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['inbounds'][0]['settings']['clients'][$i]['email']}\n";
|
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$pac['xrusers'][$i]['name']}\n";
|
||||||
$templates = $pac["{$type}templates"];
|
$templates = $pac["{$type}templates"];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
@@ -4417,33 +4535,32 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function userXr($i)
|
public function userXr($i)
|
||||||
{
|
{
|
||||||
$c = $this->getXray()['inbounds'][0]['settings']['clients'][$i];
|
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
|
$c = $pac['xrusers'][$i];
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
$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);
|
||||||
|
|
||||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['name']}\n";
|
||||||
$text[] = "<code>{$this->linkXray($i)}</code>\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['uuid']}#{$c['name']}'>v2rayng</a>";
|
||||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=si&s={$c['id']}#{$c['email']}'>sing-box</a>";
|
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=si&s={$c['uuid']}#{$c['name']}'>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['uuid']}#{$c['name']}'>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['uuid']}#{$c['name']}'>hiddify</a>";
|
||||||
|
|
||||||
$text[] = "\nv2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code>";
|
$text[] = "\nv2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['uuid']}</code>";
|
||||||
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code>";
|
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['uuid']}</code>";
|
||||||
$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['uuid']}'>windows service</a>";
|
||||||
|
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => 'v2ray',
|
'text' => 'v2ray',
|
||||||
'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['uuid']}"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => 'sing-box',
|
'text' => 'sing-box',
|
||||||
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=si&s={$c['id']}"],
|
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=si&s={$c['uuid']}"],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
@@ -4456,8 +4573,8 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => "/switchXr $i",
|
'callback_data' => "/switchXr $i",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$singtemplate = $c['singtemplate'] ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] && !empty($pac['singtemplates'][base64_decode($pac['defaultsingtemplate'])]) ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
|
$singtemplate = $c['singtemplate'] && !empty($pac['singtemplates'][base64_decode($c['singtemplate'])]) ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] && !empty($pac['singtemplates'][base64_decode($pac['defaultsingtemplate'])]) ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
|
||||||
$v2raytemplate = $c['v2raytemplate'] ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] && !empty($pac['v2raytemplates'][base64_decode($pac['defaultv2raytemplate'])]) ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
|
$v2raytemplate = $c['v2raytemplate'] && !empty($pac['v2raytemplates'][base64_decode($c['v2raytemplate'])]) ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] && !empty($pac['v2raytemplates'][base64_decode($pac['defaultv2raytemplate'])]) ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('v2ray') . ": $v2raytemplate",
|
'text' => $this->i18n('v2ray') . ": $v2raytemplate",
|
||||||
@@ -4506,45 +4623,6 @@ DNS-over-HTTPS with IP:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function v2raySubscription($key, $fs = 0)
|
|
||||||
{
|
|
||||||
$pac = $this->getPacConf();
|
|
||||||
$domain = $pac['domain'] ?: $this->ip;
|
|
||||||
$xr = $this->getXray();
|
|
||||||
|
|
||||||
$flag = true;
|
|
||||||
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
|
||||||
if ($v['id'] == $key) {
|
|
||||||
if (!empty($fs)) {
|
|
||||||
return $this->userXr($k, 0, 1);
|
|
||||||
}
|
|
||||||
if (empty($v['off'])) {
|
|
||||||
$flag = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($flag) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$c = json_decode(file_get_contents('/config/v2ray.json'), true);
|
|
||||||
|
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['users'][0]['id'] = $key;
|
|
||||||
$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['routing']['rules'][0]['domain'] = array_keys(array_filter($pac['includelist']));
|
|
||||||
|
|
||||||
if (empty($c['routing']['rules'][0]['domain'])) {
|
|
||||||
unset($c['routing']['rules'][0]);
|
|
||||||
$c['routing']['rules'] = array_values($c['routing']['rules']);
|
|
||||||
|
|
||||||
}
|
|
||||||
echo json_encode($c);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function subscription()
|
public function subscription()
|
||||||
{
|
{
|
||||||
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
||||||
@@ -4555,13 +4633,13 @@ DNS-over-HTTPS with IP:
|
|||||||
$hash = substr(md5($this->key), 0, 8);
|
$hash = substr(md5($this->key), 0, 8);
|
||||||
|
|
||||||
$flag = true;
|
$flag = true;
|
||||||
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
foreach ($pac['xrusers'] as $k => $v) {
|
||||||
if ($v['id'] == $_GET['s']) {
|
if ($v['uuid'] == $_GET['s']) {
|
||||||
if (empty($v['off'])) {
|
if (empty($v['off'])) {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
}
|
}
|
||||||
|
$uid = $v['uuid'];
|
||||||
$template = base64_decode($v["{$type}template"]);
|
$template = base64_decode($v["{$type}template"]);
|
||||||
$uid = $v['id'];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4627,9 +4705,9 @@ DNS-over-HTTPS with IP:
|
|||||||
case 's':
|
case 's':
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
$c['outbounds'][0]['settings']['vnext'][0]['address'] = $domain;
|
||||||
$c['outbounds'][0]['settings']['vnext'][0]['users'][0]['id'] = $uid;
|
$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']['serverName'] = $pac['xray']['domain'];
|
||||||
$c['outbounds'][0]['streamSettings']['realitySettings']['publicKey'] = $pac['xray'];
|
$c['outbounds'][0]['streamSettings']['realitySettings']['publicKey'] = $pac['xray']['public'];
|
||||||
$c['outbounds'][0]['streamSettings']['realitySettings']['shortId'] = $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0];
|
$c['outbounds'][0]['streamSettings']['realitySettings']['shortId'] = $pac['xray']['shortid'];
|
||||||
|
|
||||||
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 +4724,86 @@ 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;
|
switch ($pac['xtlsmode']) {
|
||||||
$c['outbounds'][0]['uuid'] = $uid;
|
case 'shadow':
|
||||||
$c['outbounds'][0]['tls']['reality']['public_key'] = $pac['xray'];
|
$o = [
|
||||||
$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];
|
"type" => "shadowtls",
|
||||||
|
"tag" => "ss-tls-out",
|
||||||
|
"server" => $domain,
|
||||||
|
"server_port" => 443,
|
||||||
|
"version" => 3,
|
||||||
|
"password" => $uid,
|
||||||
|
"tls" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"server_name" => $pac['xray']['domain'],
|
||||||
|
"utls" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"fingerprint" => "randomized"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"type" => "shadowsocks",
|
||||||
|
"tag" => "proxy",
|
||||||
|
"detour" => "ss-tls-out",
|
||||||
|
"method" => "2022-blake3-aes-128-gcm",
|
||||||
|
"password" => $pac['xray']['sspwd'],
|
||||||
|
"network" => "tcp",
|
||||||
|
"udp_over_tcp" => true,
|
||||||
|
"multiplex" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"padding" => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'trojan':
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$o = [
|
||||||
|
[
|
||||||
|
"flow" => "xtls-rprx-vision",
|
||||||
|
"packet_encoding" => "",
|
||||||
|
"server" => $domain,
|
||||||
|
"server_port" => 443,
|
||||||
|
"tls" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"insecure" => false,
|
||||||
|
"reality" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"public_key" => $pac['xray']['public'],
|
||||||
|
"short_id" => $pac['xray']['shortid']
|
||||||
|
],
|
||||||
|
"server_name" => $pac['xray']['domain'],
|
||||||
|
"utls" => [
|
||||||
|
"enabled" => true,
|
||||||
|
"fingerprint" => "chrome"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"uuid" => $uid,
|
||||||
|
"type" => "vless",
|
||||||
|
"domain_strategy" => "ipv4_only",
|
||||||
|
"tag" => "proxy"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$c['outbounds'] = array_merge($o, [
|
||||||
|
[
|
||||||
|
"type" => "direct",
|
||||||
|
"tag" => "direct"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"type" => "block",
|
||||||
|
"tag" => "block"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"type" => "dns",
|
||||||
|
"tag" => "dns-out"
|
||||||
|
]
|
||||||
|
]);
|
||||||
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'] ?: []));
|
||||||
@@ -4794,22 +4947,28 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function getXray()
|
public function getXray()
|
||||||
{
|
{
|
||||||
return json_decode(file_get_contents('/config/xray.json'), true);
|
return json_decode(file_get_contents('/config/singbox.json'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateSecretXray()
|
public function generateSecretXray()
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
$shortId = trim($this->ssh('openssl rand -hex 8', 'xr'));
|
$shortId = trim($this->ssh('openssl rand -hex 8', 'si'));
|
||||||
$keys = $this->ssh('xray x25519', 'xr');
|
$keys = $this->ssh('sing-box generate reality-keypair', 'si');
|
||||||
preg_match('~^Private key:\s([^\s]+)~m', $keys, $m);
|
preg_match('~^PrivateKey:\s([^\s]+)~m', $keys, $m);
|
||||||
$private = trim($m[1]);
|
$private = trim($m[1]);
|
||||||
preg_match('~^Public key:\s([^\s]+)~m', $keys, $m);
|
preg_match('~^PublicKey:\s([^\s]+)~m', $keys, $m);
|
||||||
$public = trim($m[1]);
|
$public = trim($m[1]);
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['privateKey'] = $private;
|
$sspwd = trim($this->ssh('sing-box generate rand --base64 16', 'si'));
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] = $shortId;
|
$pac = $this->getPacConf();
|
||||||
$pac = $this->getPacConf();
|
|
||||||
$pac['xray'] = $public;
|
$pac['xray'] = [
|
||||||
|
'domain' => !empty($pac['xray']['domain']) ? $pac['xray']['domain'] : 'vk.com',
|
||||||
|
'public' => $public,
|
||||||
|
'private' => $private,
|
||||||
|
'shortid' => $shortId,
|
||||||
|
'sspwd' => $sspwd,
|
||||||
|
];
|
||||||
$this->setPacConf($pac);
|
$this->setPacConf($pac);
|
||||||
$this->restartXray($c);
|
$this->restartXray($c);
|
||||||
}
|
}
|
||||||
@@ -4817,7 +4976,7 @@ DNS-over-HTTPS with IP:
|
|||||||
public function setUpstreamDomain($domain)
|
public function setUpstreamDomain($domain)
|
||||||
{
|
{
|
||||||
$nginx = file_get_contents('/config/upstream.conf');
|
$nginx = file_get_contents('/config/upstream.conf');
|
||||||
$t = preg_replace('~#domain.+#domain~s', "#domain\n$domain reality;\n#domain", $nginx);
|
$t = preg_replace('~#domain.+#domain~s', "#domain\n$domain singbox;\n#domain", $nginx);
|
||||||
file_put_contents('/config/upstream.conf', $t);
|
file_put_contents('/config/upstream.conf', $t);
|
||||||
$this->ssh("nginx -s reload 2>&1", 'up');
|
$this->ssh("nginx -s reload 2>&1", 'up');
|
||||||
}
|
}
|
||||||
@@ -4953,7 +5112,7 @@ DNS-over-HTTPS with IP:
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('third party browser') . ': ' . $this->i18n($conf['adgbrowser'] ? 'on' : 'off'),
|
'text' => $this->i18n($conf['adgbrowser'] ? 'on' : 'off') . ' ' . $this->i18n('third party browser'),
|
||||||
'callback_data' => '/adguardChBr'
|
'callback_data' => '/adguardChBr'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -5292,7 +5451,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->update(
|
$this->update(
|
||||||
$this->input['chat'],
|
$this->input['chat'],
|
||||||
$this->input['message_id'],
|
$this->input['message_id'],
|
||||||
implode("\n", $text ?: ['...']),
|
implode("\n", ['...']),
|
||||||
$data ?: false,
|
$data ?: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -5380,24 +5539,18 @@ DNS-over-HTTPS with IP:
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFakeDomain($domain, $self = false)
|
public function setFakeDomain($domain)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$pac = $this->getPacConf();
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] = $domain;
|
if ($pac['domain'] == $domain) {
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['dest'] = $self ? "10.10.1.2:443" : "$domain:443";
|
$this->send($this->input['from'], 'wrong domain');
|
||||||
$this->restartXray($c);
|
return;
|
||||||
$this->setUpstreamDomain($domain);
|
|
||||||
$this->xray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function selfFakeDomain()
|
|
||||||
{
|
|
||||||
$c = $this->getPacConf();
|
|
||||||
if (!empty($c['domain'])) {
|
|
||||||
$this->setFakeDomain($c['domain'], 1);
|
|
||||||
} else{
|
|
||||||
$this->answer($this->input['callback_id'], 'empty domain', true);
|
|
||||||
}
|
}
|
||||||
|
$pac['xray']['domain'] = $domain;
|
||||||
|
$this->setPacConf($pac);
|
||||||
|
$this->setUpstreamDomain($domain);
|
||||||
|
$this->restartXray();
|
||||||
|
$this->xray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBackup($text)
|
public function setBackup($text)
|
||||||
@@ -5477,7 +5630,7 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function nginxGetTypeCert()
|
public function nginxGetTypeCert()
|
||||||
{
|
{
|
||||||
$conf = $this->ssh('cat /etc/nginx/nginx.conf', 'ng');
|
$conf = file_get_contents('/config/nginx.conf');
|
||||||
preg_match("/#~([^\s]+)/", $conf, $m);
|
preg_match("/#~([^\s]+)/", $conf, $m);
|
||||||
return $m[1];
|
return $m[1];
|
||||||
}
|
}
|
||||||
@@ -5771,6 +5924,12 @@ DNS-over-HTTPS with IP:
|
|||||||
die('нет айпи');
|
die('нет айпи');
|
||||||
}
|
}
|
||||||
echo "$ip\n";
|
echo "$ip\n";
|
||||||
|
$this->request('deleteWebhook', []);
|
||||||
|
$this->request('getUpdates', [
|
||||||
|
'offset' => -1,
|
||||||
|
'limit' => 1,
|
||||||
|
'timeout' => 5,
|
||||||
|
]);
|
||||||
var_dump($r = $this->request('setWebhook', [
|
var_dump($r = $this->request('setWebhook', [
|
||||||
'url' => "https://$ip/tlgrm?k={$this->key}",
|
'url' => "https://$ip/tlgrm?k={$this->key}",
|
||||||
'certificate' => curl_file_create('/certs/self_public'),
|
'certificate' => curl_file_create('/certs/self_public'),
|
||||||
|
|||||||
+2
-2
@@ -262,8 +262,8 @@ $i = [
|
|||||||
'ru' => 'очистить',
|
'ru' => 'очистить',
|
||||||
],
|
],
|
||||||
'xray' => [
|
'xray' => [
|
||||||
'en' => 'XTLS-Reality',
|
'en' => 'Sing-box',
|
||||||
'ru' => 'XTLS-Reality',
|
'ru' => 'Sing-box',
|
||||||
],
|
],
|
||||||
'geodb' => [
|
'geodb' => [
|
||||||
'en' => 'GeoIp/GeoSite',
|
'en' => 'GeoIp/GeoSite',
|
||||||
|
|||||||
+4
-6
@@ -2,7 +2,6 @@ user nginx;
|
|||||||
worker_processes auto;
|
worker_processes auto;
|
||||||
|
|
||||||
error_log /logs/nginx_error;
|
error_log /logs/nginx_error;
|
||||||
pid /var/run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
@@ -22,8 +21,8 @@ http {
|
|||||||
set_real_ip_from 10.10.0.10;
|
set_real_ip_from 10.10.0.10;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 10.10.0.2:80 default_server;
|
listen 80 default_server;
|
||||||
listen 10.10.0.2:443 ssl http2 default_server proxy_protocol;
|
listen 443 ssl http2 default_server proxy_protocol;
|
||||||
ssl_certificate /certs/self_public;
|
ssl_certificate /certs/self_public;
|
||||||
ssl_certificate_key /certs/self_private;
|
ssl_certificate_key /certs/self_private;
|
||||||
|
|
||||||
@@ -75,12 +74,11 @@ http {
|
|||||||
|
|
||||||
#-domain
|
#-domain
|
||||||
# server {
|
# server {
|
||||||
# listen 10.10.0.2:80;
|
# listen 80;
|
||||||
# server_name ;
|
# server_name ;
|
||||||
#-domain
|
#-domain
|
||||||
#-ssl
|
#-ssl
|
||||||
# listen 10.10.0.2:443 ssl http2 proxy_protocol;
|
# listen 443 ssl http2 proxy_protocol;
|
||||||
# listen 10.10.1.2:443 ssl http2;
|
|
||||||
# ssl_certificate /certs/cert_public;
|
# ssl_certificate /certs/cert_public;
|
||||||
# ssl_certificate_key /certs/cert_private;
|
# ssl_certificate_key /certs/cert_private;
|
||||||
#-ssl
|
#-ssl
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ user nginx;
|
|||||||
worker_processes auto;
|
worker_processes auto;
|
||||||
|
|
||||||
error_log /logs/nginx_error;
|
error_log /logs/nginx_error;
|
||||||
pid /var/run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
@@ -22,8 +21,8 @@ http {
|
|||||||
set_real_ip_from 10.10.0.10;
|
set_real_ip_from 10.10.0.10;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 10.10.0.2:80 default_server;
|
listen 80 default_server;
|
||||||
listen 10.10.0.2:443 ssl http2 default_server proxy_protocol;
|
listen 443 ssl http2 default_server proxy_protocol;
|
||||||
ssl_certificate /certs/self_public;
|
ssl_certificate /certs/self_public;
|
||||||
ssl_certificate_key /certs/self_private;
|
ssl_certificate_key /certs/self_private;
|
||||||
|
|
||||||
@@ -75,12 +74,11 @@ http {
|
|||||||
|
|
||||||
#-domain
|
#-domain
|
||||||
# server {
|
# server {
|
||||||
# listen 10.10.0.2:80;
|
# listen 80;
|
||||||
# server_name ;
|
# server_name ;
|
||||||
#-domain
|
#-domain
|
||||||
#-ssl
|
#-ssl
|
||||||
# listen 10.10.0.2:443 ssl http2 proxy_protocol;
|
# listen 443 ssl http2 proxy_protocol;
|
||||||
# listen 10.10.1.2:443 ssl http2;
|
|
||||||
# ssl_certificate /certs/cert_public;
|
# ssl_certificate /certs/cert_public;
|
||||||
# ssl_certificate_key /certs/cert_private;
|
# ssl_certificate_key /certs/cert_private;
|
||||||
#-ssl
|
#-ssl
|
||||||
|
|||||||
+2
-98
@@ -1,99 +1,3 @@
|
|||||||
{
|
{
|
||||||
"zapret": false,
|
"includelist": []
|
||||||
"excludelist": {
|
}
|
||||||
"(?:v|w)ul(?:c|k)an": true,
|
|
||||||
"^\\d": true,
|
|
||||||
"^a\\w-": true,
|
|
||||||
"^admiral": true,
|
|
||||||
"^avtomaty": true,
|
|
||||||
"^azart": true,
|
|
||||||
"^azimob": true,
|
|
||||||
"^baltplay": true,
|
|
||||||
"a(?:s|z)ino": true,
|
|
||||||
"adrenalin": true,
|
|
||||||
"alco": true,
|
|
||||||
"bet": true,
|
|
||||||
"prostitut": true,
|
|
||||||
"zenit": true,
|
|
||||||
"zerkalo": true,
|
|
||||||
"777": true
|
|
||||||
},
|
|
||||||
"includelist": {},
|
|
||||||
"reverselist": {},
|
|
||||||
"subzoneslist": {
|
|
||||||
"3dn": false,
|
|
||||||
"3nx": true,
|
|
||||||
"akadns": true,
|
|
||||||
"appspot": true,
|
|
||||||
"azurewebsites": true,
|
|
||||||
"beget": true,
|
|
||||||
"berlogovo": true,
|
|
||||||
"biz": true,
|
|
||||||
"brightcove": true,
|
|
||||||
"cc": true,
|
|
||||||
"cloudfront": true,
|
|
||||||
"co": true,
|
|
||||||
"com": true,
|
|
||||||
"cu": true,
|
|
||||||
"ddns": true,
|
|
||||||
"deviantart": true,
|
|
||||||
"dn": true,
|
|
||||||
"dp": true,
|
|
||||||
"dyndns": true,
|
|
||||||
"edgecastcdn": true,
|
|
||||||
"edu": true,
|
|
||||||
"eu": true,
|
|
||||||
"fastly": true,
|
|
||||||
"force": true,
|
|
||||||
"github": true,
|
|
||||||
"google": true,
|
|
||||||
"googleusercontent": true,
|
|
||||||
"gov": true,
|
|
||||||
"herokuapp": true,
|
|
||||||
"hldns": true,
|
|
||||||
"ho": true,
|
|
||||||
"hopto": true,
|
|
||||||
"hwcdn": true,
|
|
||||||
"i": true,
|
|
||||||
"iboards": true,
|
|
||||||
"in": true,
|
|
||||||
"info": true,
|
|
||||||
"int": true,
|
|
||||||
"itch": true,
|
|
||||||
"keenetic": true,
|
|
||||||
"kiev": true,
|
|
||||||
"kirov": true,
|
|
||||||
"linode": true,
|
|
||||||
"livejournal": true,
|
|
||||||
"maryno": true,
|
|
||||||
"mil": true,
|
|
||||||
"msk": true,
|
|
||||||
"my1": true,
|
|
||||||
"mybb2": true,
|
|
||||||
"ne": true,
|
|
||||||
"net": true,
|
|
||||||
"netdna-ssl": true,
|
|
||||||
"nnov": true,
|
|
||||||
"notion": true,
|
|
||||||
"nov": true,
|
|
||||||
"od": true,
|
|
||||||
"org": true,
|
|
||||||
"pp": true,
|
|
||||||
"pximg": true,
|
|
||||||
"pythonanywhere": true,
|
|
||||||
"ru": true,
|
|
||||||
"scaleway": true,
|
|
||||||
"sl": true,
|
|
||||||
"sl-reverse": true,
|
|
||||||
"spb": true,
|
|
||||||
"tilda": true,
|
|
||||||
"trafficmanager": true,
|
|
||||||
"tut": true,
|
|
||||||
"u-stream": true,
|
|
||||||
"ucoz": true,
|
|
||||||
"v": true,
|
|
||||||
"vercel": true,
|
|
||||||
"wix": true,
|
|
||||||
"wixmp": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-45
@@ -54,54 +54,10 @@
|
|||||||
"detour": "direct"
|
"detour": "direct"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "dns-direct",
|
|
||||||
"disable_cache": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"strategy": "ipv4_only",
|
"strategy": "ipv4_only",
|
||||||
"independent_cache": true
|
"independent_cache": true
|
||||||
},
|
},
|
||||||
"outbounds": [
|
"outbounds": [],
|
||||||
{
|
|
||||||
"flow": "xtls-rprx-vision",
|
|
||||||
"packet_encoding": "",
|
|
||||||
"server": "",
|
|
||||||
"server_port": 443,
|
|
||||||
"tls": {
|
|
||||||
"enabled": true,
|
|
||||||
"insecure": false,
|
|
||||||
"reality": {
|
|
||||||
"enabled": true,
|
|
||||||
"public_key": "",
|
|
||||||
"short_id": ""
|
|
||||||
},
|
|
||||||
"server_name": "",
|
|
||||||
"utls": {
|
|
||||||
"enabled": true,
|
|
||||||
"fingerprint": "chrome"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"uuid": "",
|
|
||||||
"type": "vless",
|
|
||||||
"domain_strategy": "ipv4_only",
|
|
||||||
"tag": "proxy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "direct",
|
|
||||||
"tag": "direct"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "block",
|
|
||||||
"tag": "block"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "dns",
|
|
||||||
"tag": "dns-out"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"route": {
|
"route": {
|
||||||
"auto_detect_interface": true,
|
"auto_detect_interface": true,
|
||||||
"override_android_vpn": true,
|
"override_android_vpn": true,
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"inbounds": [],
|
||||||
|
"log": {
|
||||||
|
"level": "info"
|
||||||
|
},
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"type": "direct",
|
||||||
|
"tag": "direct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "block",
|
||||||
|
"tag": "block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "socks",
|
||||||
|
"tag": "warp",
|
||||||
|
"server": "10.10.0.13",
|
||||||
|
"server_port": 4000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"route" : {
|
||||||
|
"rules": [],
|
||||||
|
"final": "direct"
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-5
@@ -15,8 +15,12 @@ stream {
|
|||||||
server ng:443;
|
server ng:443;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream reality {
|
upstream si {
|
||||||
server xr:443;
|
server si:443;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream singbox {
|
||||||
|
server 127.0.0.1:4443;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream ocserv {
|
upstream ocserv {
|
||||||
@@ -30,7 +34,7 @@ stream {
|
|||||||
map_hash_bucket_size 128;
|
map_hash_bucket_size 128;
|
||||||
map $ssl_preread_server_name $sni_name {
|
map $ssl_preread_server_name $sni_name {
|
||||||
#domain
|
#domain
|
||||||
www.microsoft.com reality;
|
vk.com singbox;
|
||||||
#domain
|
#domain
|
||||||
|
|
||||||
#ocserv
|
#ocserv
|
||||||
@@ -43,17 +47,22 @@ stream {
|
|||||||
default other;
|
default other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 4443 reuseport proxy_protocol;
|
||||||
|
proxy_pass si;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 reuseport;
|
listen 443 reuseport;
|
||||||
proxy_pass $sni_name;
|
proxy_pass $sni_name;
|
||||||
proxy_protocol on;
|
|
||||||
ssl_preread on;
|
ssl_preread on;
|
||||||
|
proxy_protocol on;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 udp;
|
listen 443 udp;
|
||||||
proxy_pass $sni_name;
|
proxy_pass $sni_name;
|
||||||
proxy_protocol on;
|
|
||||||
ssl_preread on;
|
ssl_preread on;
|
||||||
|
proxy_protocol on;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
{
|
|
||||||
"inbounds": [
|
|
||||||
{
|
|
||||||
"port": 443,
|
|
||||||
"protocol": "vless",
|
|
||||||
"settings": {
|
|
||||||
"clients": [
|
|
||||||
],
|
|
||||||
"decryption": "none"
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
],
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"streamSettings": {
|
|
||||||
"network": "tcp",
|
|
||||||
"realitySettings": {
|
|
||||||
"dest": "www.microsoft.com:443",
|
|
||||||
"maxClientVer": "",
|
|
||||||
"maxTimeDiff": 0,
|
|
||||||
"minClientVer": "",
|
|
||||||
"privateKey": "",
|
|
||||||
"serverNames": [
|
|
||||||
"www.microsoft.com"
|
|
||||||
],
|
|
||||||
"shortIds": [],
|
|
||||||
"show": false,
|
|
||||||
"xver": 0
|
|
||||||
},
|
|
||||||
"tcpSettings": {
|
|
||||||
"acceptProxyProtocol": true
|
|
||||||
},
|
|
||||||
"sockopt": {
|
|
||||||
"acceptProxyProtocol": true
|
|
||||||
},
|
|
||||||
"security": "reality"
|
|
||||||
},
|
|
||||||
"tag": "vless_tls"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"log": {
|
|
||||||
"loglevel": "info"
|
|
||||||
},
|
|
||||||
"outbounds": [
|
|
||||||
{
|
|
||||||
"protocol": "freedom",
|
|
||||||
"tag": "direct"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"protocol": "blackhole",
|
|
||||||
"tag": "block"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"routing": {
|
|
||||||
"domainStrategy": "AsIs",
|
|
||||||
"rules": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+12
-21
@@ -10,10 +10,6 @@ networks:
|
|||||||
ipam:
|
ipam:
|
||||||
config:
|
config:
|
||||||
- subnet: 10.10.0.0/24
|
- subnet: 10.10.0.0/24
|
||||||
xray:
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 10.10.1.0/24
|
|
||||||
volumes:
|
volumes:
|
||||||
adguard:
|
adguard:
|
||||||
|
|
||||||
@@ -27,9 +23,9 @@ services:
|
|||||||
image: ${IMAGE}
|
image: ${IMAGE}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/.profile:/root/.ashrc:ro
|
- ./config/.profile:/root/.ashrc:ro
|
||||||
- ./config/upstream.conf:/etc/nginx/nginx.conf
|
|
||||||
- ./scripts/start_upstream.sh:/start_upstream.sh
|
- ./scripts/start_upstream.sh:/start_upstream.sh
|
||||||
- ./ssh:/ssh
|
- ./ssh:/ssh
|
||||||
|
- ./config:/config
|
||||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||||
- ./logs/:/logs/
|
- ./logs/:/logs/
|
||||||
ports:
|
ports:
|
||||||
@@ -63,9 +59,7 @@ services:
|
|||||||
image: ${IMAGE}
|
image: ${IMAGE}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/.profile:/root/.ashrc:ro
|
- ./config/.profile:/root/.ashrc:ro
|
||||||
- ./config/nginx.conf:/etc/nginx/nginx.conf
|
- ./config:/config
|
||||||
- ./config/include.conf:/etc/nginx/include.conf
|
|
||||||
- ./config/nginx_default.conf:/nginx_default.conf
|
|
||||||
- ./scripts/start_ng.sh:/start_ng.sh
|
- ./scripts/start_ng.sh:/start_ng.sh
|
||||||
- ./certs/:/certs/
|
- ./certs/:/certs/
|
||||||
- ./ssh:/ssh
|
- ./ssh:/ssh
|
||||||
@@ -89,8 +83,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
ipv4_address: 10.10.0.2
|
ipv4_address: 10.10.0.2
|
||||||
xray:
|
|
||||||
ipv4_address: 10.10.1.2
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
php:
|
php:
|
||||||
image: mercurykd/vpnbot-php:1.5
|
image: mercurykd/vpnbot-php:1.5
|
||||||
@@ -187,7 +179,7 @@ services:
|
|||||||
- ad
|
- ad
|
||||||
- ss
|
- ss
|
||||||
- tg
|
- tg
|
||||||
- xr
|
- si
|
||||||
- oc
|
- oc
|
||||||
- np
|
- np
|
||||||
proxy:
|
proxy:
|
||||||
@@ -398,20 +390,21 @@ services:
|
|||||||
default:
|
default:
|
||||||
ipv4_address: 10.10.0.8
|
ipv4_address: 10.10.0.8
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
xr:
|
si:
|
||||||
image: mercurykd/vpnbot-xr:1.3
|
image: mercurykd/vpnbot-sb:1.2
|
||||||
build:
|
build:
|
||||||
dockerfile: dockerfile/xray.dockerfile
|
dockerfile: dockerfile/singbox.dockerfile
|
||||||
args:
|
args:
|
||||||
image: ${IMAGE}
|
image: ${IMAGE}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/.profile:/root/.ashrc:ro
|
- ./config/.profile:/root/.ashrc:ro
|
||||||
- ./ssh:/ssh
|
- ./ssh:/ssh
|
||||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||||
- ./config/xray.json:/xray.json
|
- ./config:/config
|
||||||
- ./scripts/start_xray.sh:/start_xray.sh
|
- ./certs:/certs
|
||||||
hostname: xray
|
- ./scripts/start_sing.sh:/start_sing.sh
|
||||||
container_name: xray-${VER}
|
hostname: singbox
|
||||||
|
container_name: singbox-${VER}
|
||||||
depends_on:
|
depends_on:
|
||||||
php:
|
php:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -421,12 +414,10 @@ services:
|
|||||||
- path: ./override.env
|
- path: ./override.env
|
||||||
required: false
|
required: false
|
||||||
stop_grace_period: 1s
|
stop_grace_period: 1s
|
||||||
command: ["/bin/sh", "/start_xray.sh"]
|
command: ["/bin/sh", "/start_sing.sh"]
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
ipv4_address: 10.10.0.9
|
ipv4_address: 10.10.0.9
|
||||||
xray:
|
|
||||||
ipv4_address: 10.10.1.9
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
oc:
|
oc:
|
||||||
image: mercurykd/vpnbot-oc:1.2
|
image: mercurykd/vpnbot-oc:1.2
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
ARG image
|
||||||
|
FROM $image
|
||||||
|
RUN apk add openssh openssl jq \
|
||||||
|
&& mkdir /root/.ssh \
|
||||||
|
&& wget https://github.com/SagerNet/sing-box/releases/download/v1.9.3/sing-box-1.9.3-linux-amd64.tar.gz \
|
||||||
|
&& tar -xf sing-box-1.9.3-linux-amd64.tar.gz \
|
||||||
|
&& mv sing-box-1.9.3-linux-amd64/sing-box /usr/bin \
|
||||||
|
&& rm sing-box-1.9.3-linux-amd64.tar.gz \
|
||||||
|
&& rm -rf /sing-box-1.9.3-linux-amd64
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
ARG image
|
|
||||||
FROM $image
|
|
||||||
RUN apk add openssh openssl jq \
|
|
||||||
&& mkdir /root/.ssh \
|
|
||||||
&& wget -O Xray-linux-64.zip $(wget -q -O - https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'Xray-linux-64.zip$') \
|
|
||||||
&& unzip Xray-linux-64.zip \
|
|
||||||
&& mv xray /usr/bin/ \
|
|
||||||
&& rm Xray-linux-64.zip \
|
|
||||||
&& rm geoip.dat \
|
|
||||||
&& rm geosite.dat \
|
|
||||||
&& chmod +x /usr/bin/xray
|
|
||||||
ENV ENV="/root/.ashrc"
|
|
||||||
@@ -36,8 +36,8 @@ proxy: # консоль сервиса
|
|||||||
docker compose exec proxy /bin/sh
|
docker compose exec proxy /bin/sh
|
||||||
tg: # консоль сервиса
|
tg: # консоль сервиса
|
||||||
docker compose exec tg /bin/sh
|
docker compose exec tg /bin/sh
|
||||||
xr: # консоль сервиса
|
si: # консоль сервиса
|
||||||
docker compose exec xr /bin/sh
|
docker compose exec si /bin/sh
|
||||||
oc: # консоль сервиса
|
oc: # консоль сервиса
|
||||||
docker compose exec oc /bin/sh
|
docker compose exec oc /bin/sh
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
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 "$@" &
|
||||||
sed "s/ss:[0-9]\+/ss:$SSPORT/" /nginx_default.conf > change_port
|
sed "s/ss:[0-9]\+/ss:$SSPORT/" /config/nginx_default.conf > change_port
|
||||||
cat change_port > /nginx_default.conf
|
cat change_port > /config/nginx_default.conf
|
||||||
sed "s/ss:[0-9]\+/ss:$SSPORT/" /etc/nginx/nginx.conf > change_port
|
sed "s/ss:[0-9]\+/ss:$SSPORT/" /config/nginx.conf > change_port
|
||||||
cat change_port > /etc/nginx/nginx.conf
|
cat change_port > /config/nginx.conf
|
||||||
nginx -g "daemon off;"
|
nginx -g "daemon off;" -c /config/nginx.conf
|
||||||
|
|||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||||
|
ssh-keygen -A
|
||||||
|
exec /usr/sbin/sshd -D -e "$@" &
|
||||||
|
sing-box run -c /config/singbox.json > /dev/null &
|
||||||
|
tail -f /dev/null
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
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 "$@" &
|
||||||
nginx -g "daemon off;"
|
nginx -g "daemon off;" -c /config/upstream.conf
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
|
||||||
ssh-keygen -A
|
|
||||||
exec /usr/sbin/sshd -D -e "$@" &
|
|
||||||
if [ $(cat /xray.json | jq -r '.inbounds[0].settings.clients[0].id' | wc -c) -gt 1 ]
|
|
||||||
then
|
|
||||||
xray run -config /xray.json > /dev/null &
|
|
||||||
fi
|
|
||||||
tail -f /dev/null
|
|
||||||
Reference in New Issue
Block a user