Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e53000065 | |||
| 18ceb51f4e | |||
| 99bce7a988 | |||
| 446a5d7150 | |||
| 855f516936 | |||
| e1c13480d1 | |||
| bd5e10fa23 | |||
| 3627b389b4 | |||
| f3f9cb5348 | |||
| 1527b9f856 | |||
| f896b307ea |
+113
-14
@@ -2580,9 +2580,9 @@ DNS-over-HTTPS with IP:
|
||||
case 'rulessetlist':
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} [direct | block | proxy]:time:URL",
|
||||
"@{$this->input['username']} outbound[:behavior]:time:URL",
|
||||
$this->input['message_id'],
|
||||
reply: '[direct | block | proxy]:time:URL',
|
||||
reply: 'outbound[:behavior]:time:URL',
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -3130,9 +3130,6 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function subnetSave($text, $wgpage, $page, $openconnect)
|
||||
{
|
||||
if (!preg_match('~^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}$~', $text)) {
|
||||
return $this->send($this->input['chat'], "wrong format: $text", $this->input['message_id']);
|
||||
}
|
||||
$c = $this->getPacConf();
|
||||
$subnets = explode(',', $text);
|
||||
if ($subnets) {
|
||||
@@ -5331,7 +5328,7 @@ DNS-over-HTTPS with IP:
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $this->getDomain();
|
||||
$hash = substr(md5($this->key), 0, 8);
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> $type templates";
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> " . $this->i18n($type) . " templates";
|
||||
$text[] = <<<TEXT
|
||||
<code>~outbound~</code>
|
||||
<code>"~pac~"</code>
|
||||
@@ -5494,7 +5491,7 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/templates sing",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('clash templates'),
|
||||
'text' => $this->i18n('mihomo templates'),
|
||||
'callback_data' => "/templates clash",
|
||||
],
|
||||
];
|
||||
@@ -5788,7 +5785,7 @@ DNS-over-HTTPS with IP:
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=st&s={$c['id']}#{$c['email']}'>import://streisand</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=h&s={$c['id']}#{$c['email']}'>import://hiddify</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=k&s={$c['id']}#{$c['email']}'>import://karing</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=c&s={$c['id']}#{$c['email']}'>import://clash</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=c&s={$c['id']}#{$c['email']}'>import://mihomo</a>";
|
||||
|
||||
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||
'h' => $hash,
|
||||
@@ -5808,19 +5805,23 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
$text[] = "\nxray config: <pre><code>$xr</code></pre>";
|
||||
$text[] = "sing-box config: <pre><code>$si</code></pre>";
|
||||
$text[] = "clash config: <pre><code>$cl</code></pre>";
|
||||
$text[] = "mihomo config: <pre><code>$cl</code></pre>";
|
||||
|
||||
$text[] = "sing-box windows: <a href='$scheme://{$domain}/pac?h=$hash&t=si&r=w&s={$c['id']}'>windows service</a>";
|
||||
|
||||
$data[] = [
|
||||
[
|
||||
'text' => 'xray',
|
||||
'text' => $this->i18n('v2ray'),
|
||||
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=s&s={$c['id']}"],
|
||||
],
|
||||
[
|
||||
'text' => 'sing-box',
|
||||
'text' => $this->i18n('singbox'),
|
||||
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=si&s={$c['id']}"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('mihomo'),
|
||||
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=cl&s={$c['id']}"],
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
@@ -5845,7 +5846,7 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/templateUser sing $i",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('clash') . ": $clashtemplate",
|
||||
'text' => $this->i18n('mihomo') . ": $clashtemplate",
|
||||
'callback_data' => "/templateUser clash $i",
|
||||
],
|
||||
];
|
||||
@@ -6137,8 +6138,13 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
break;
|
||||
case 'cl':
|
||||
$c = $this->createClashRuleSet($c, $uid, $domain);
|
||||
$c = $this->addClashRuleSet($c);
|
||||
if (!empty($c['rules'])) {
|
||||
$c['rules'] = $this->clashRules($c['rules']);
|
||||
if (count($c['rules']) == 1) {
|
||||
unset($c['rules']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -6153,6 +6159,99 @@ DNS-over-HTTPS with IP:
|
||||
echo json_encode($c);
|
||||
}
|
||||
|
||||
public function createClashRuleSet($c, $uid, $domain)
|
||||
{
|
||||
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||
$hash = substr(md5($this->key), 0, 8);
|
||||
if (!empty($c['rule-providers'])) {
|
||||
foreach ($c['rule-providers'] as $k => $v) {
|
||||
if (array_key_exists('list', $v)) {
|
||||
if (!empty($_GET['r']) && $k == $_GET['r']) {
|
||||
header("Content-Disposition: attachment; filename=$k.yaml");
|
||||
header('Content-Type: text/yaml');
|
||||
switch ($v['behavior']) {
|
||||
case 'domain':
|
||||
echo yaml_emit(['payload' => array_map(fn($e) => "+.$e", $v['list'])]);
|
||||
break;
|
||||
|
||||
default:
|
||||
echo yaml_emit(['payload' => array_map(fn($e) => "PROCESS-NAME,$e", $v['list'])]);
|
||||
break;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
$c['rule-providers'][$k] = [
|
||||
'type' => 'http',
|
||||
'url' => "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||
'h' => $hash,
|
||||
't' => 'cl',
|
||||
's' => $uid,
|
||||
'r' => $k,
|
||||
])),
|
||||
'interval' => $v['interval'],
|
||||
'behavior' => $v['behavior'],
|
||||
'format' => 'yaml',
|
||||
];
|
||||
switch ($v['action']) {
|
||||
case 'reject':
|
||||
case 'REJECT':
|
||||
array_unshift($c['rules'], [
|
||||
'RULE-SET', $k, strtoupper($v['action'])
|
||||
]);
|
||||
break;
|
||||
|
||||
default:
|
||||
array_splice($c['rules'], count($c['rules']) - 1, 0, [[
|
||||
'RULE-SET', $k, strtoupper($v['action'])
|
||||
]]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function addClashRuleSet($c)
|
||||
{
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($p['rulessetlist']) && $c['add-rule-providers']) {
|
||||
foreach ($p['rulessetlist'] as $k => $v) {
|
||||
if (!empty($v)) {
|
||||
[$type, $behavior, $time, $url] = explode(':', $k, 4);
|
||||
if (preg_match('~\.(mrs|yaml|yml)$~', $url, $m)) {
|
||||
$c['rule-providers'][$url] = [
|
||||
'type' => 'http',
|
||||
'url' => $url,
|
||||
'interval' => (int) $time,
|
||||
'behavior' => $behavior,
|
||||
'format' => $m[1],
|
||||
];
|
||||
switch ($type) {
|
||||
case 'reject':
|
||||
case 'REJECT':
|
||||
array_unshift($c['rules'], [
|
||||
'RULE-SET', $url, strtoupper($type)
|
||||
]);
|
||||
break;
|
||||
|
||||
default:
|
||||
array_splice($c['rules'], count($c['rules']) - 1, 0, [[
|
||||
'RULE-SET', $url, strtoupper($type)
|
||||
]]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($c['add-rule-providers']);
|
||||
if (empty($c['rule-providers'])) {
|
||||
unset($c['rule-providers']);
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function clashRules($rules)
|
||||
{
|
||||
foreach ($rules as $v) {
|
||||
@@ -6163,7 +6262,7 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$tmp[] = "{$v['type']}, {$v['action']}";
|
||||
$tmp[] = implode(', ', $v);
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
@@ -6187,7 +6286,7 @@ DNS-over-HTTPS with IP:
|
||||
foreach ($p['rulessetlist'] as $k => $v) {
|
||||
if (!empty($v)) {
|
||||
[$type, $time, $url] = explode(':', $k, 3);
|
||||
if (!empty($route['rules'][$t[$type]])) {
|
||||
if (preg_match('~\.srs$~', $url) && !empty($route['rules'][$t[$type]])) {
|
||||
$route['rule_set'][] = [
|
||||
"tag" => $k,
|
||||
"type" => "remote",
|
||||
|
||||
+6
-2
@@ -262,8 +262,12 @@ $i = [
|
||||
'ru' => 'очистить',
|
||||
],
|
||||
'xray' => [
|
||||
'en' => 'Xray',
|
||||
'ru' => 'Xray',
|
||||
'en' => 'Vless',
|
||||
'ru' => 'Vless',
|
||||
],
|
||||
'clash' => [
|
||||
'en' => 'mihomo',
|
||||
'ru' => 'mihomo',
|
||||
],
|
||||
'geodb' => [
|
||||
'en' => 'GeoIp/GeoSite',
|
||||
|
||||
+31
-23
@@ -6,7 +6,7 @@
|
||||
"find-process-mode": "strict",
|
||||
"global-client-fingerprint": "chrome",
|
||||
"mode": "rule",
|
||||
"log-level": "debug",
|
||||
"log-level": "info",
|
||||
"ipv6": false,
|
||||
"keep-alive-interval": 30,
|
||||
"unified-delay": false,
|
||||
@@ -90,32 +90,40 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"type": "DOMAIN-SUFFIX",
|
||||
"add-rule-providers": true,
|
||||
"rule-providers": {
|
||||
"block": {
|
||||
"list": "~block~",
|
||||
"action": "REJECT"
|
||||
"interval": 30,
|
||||
"action": "REJECT",
|
||||
"behavior": "domain"
|
||||
},
|
||||
{
|
||||
"type": "PROCESS-NAME",
|
||||
"list": "~process~",
|
||||
"action": "PROXY"
|
||||
},
|
||||
{
|
||||
"type": "PROCESS-NAME",
|
||||
"list": "~package~",
|
||||
"action": "PROXY"
|
||||
},
|
||||
{
|
||||
"type": "DOMAIN-SUFFIX",
|
||||
"list": "~warp~",
|
||||
"action": "PROXY"
|
||||
},
|
||||
{
|
||||
"type": "DOMAIN-SUFFIX",
|
||||
"pac": {
|
||||
"list": "~pac~",
|
||||
"action": "PROXY"
|
||||
"interval": 30,
|
||||
"action": "PROXY",
|
||||
"behavior": "domain"
|
||||
},
|
||||
"warp": {
|
||||
"list": "~warp~",
|
||||
"interval": 30,
|
||||
"action": "PROXY",
|
||||
"behavior": "domain"
|
||||
},
|
||||
"package": {
|
||||
"list": "~package~",
|
||||
"interval": 30,
|
||||
"action": "PROXY",
|
||||
"behavior": "classical"
|
||||
},
|
||||
"process": {
|
||||
"list": "~process~",
|
||||
"interval": 30,
|
||||
"action": "PROXY",
|
||||
"behavior": "classical"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"type": "MATCH",
|
||||
"action": "DIRECT"
|
||||
|
||||
+5
-5
@@ -115,7 +115,7 @@
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "pac",
|
||||
"interval": "15s",
|
||||
"interval": "30s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~pac~"
|
||||
@@ -130,7 +130,7 @@
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "package",
|
||||
"interval": "15s",
|
||||
"interval": "30s",
|
||||
"rules": [
|
||||
{
|
||||
"package_name": "~package~"
|
||||
@@ -145,7 +145,7 @@
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "process",
|
||||
"interval": "15s",
|
||||
"interval": "30s",
|
||||
"rules": [
|
||||
{
|
||||
"process_name": "~process~"
|
||||
@@ -160,7 +160,7 @@
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "block",
|
||||
"interval": "15s",
|
||||
"interval": "30s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~block~"
|
||||
@@ -175,7 +175,7 @@
|
||||
"createruleset": [
|
||||
{
|
||||
"name": "warp",
|
||||
"interval": "15s",
|
||||
"interval": "30s",
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": "~warp~"
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ services:
|
||||
ipv4_address: 10.10.1.2
|
||||
logging: *default-logging
|
||||
php:
|
||||
image: mercurykd/vpnbot-php:1.6
|
||||
image: mercurykd/vpnbot-php:1.7
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -405,7 +405,7 @@ services:
|
||||
ipv4_address: 10.10.0.8
|
||||
logging: *default-logging
|
||||
xr:
|
||||
image: mercurykd/vpnbot-xr:1.3
|
||||
image: mercurykd/vpnbot-xr:1.4
|
||||
build:
|
||||
dockerfile: dockerfile/xray.dockerfile
|
||||
args:
|
||||
|
||||
+12
-11
@@ -22,16 +22,17 @@ RUN apk add --no-cache --update php81 \
|
||||
curl \
|
||||
git \
|
||||
py3-qt5 \
|
||||
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& mkdir /root/.ssh \
|
||||
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.11.1/dnslookup-linux-amd64-v1.11.1.tar.gz \
|
||||
&& tar -xf dnslookup-linux-amd64-v1.11.1.tar.gz \
|
||||
&& mv linux-amd64/dnslookup /usr/bin \
|
||||
&& rm dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& rm dnslookup-linux-amd64-v1.11.1.tar.gz \
|
||||
&& rm -rf /linux-amd64 \
|
||||
&& wget https://github.com/SagerNet/sing-box/releases/download/v1.8.11/sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& tar -xf sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& mv sing-box-1.8.11-linux-amd64/sing-box /usr/bin \
|
||||
&& rm sing-box-1.8.11-linux-amd64.tar.gz \
|
||||
&& rm -rf /sing-box-1.8.11-linux-amd64
|
||||
RUN apk add openssh \
|
||||
&& mkdir /root/.ssh
|
||||
ENV ENV="/root/.ashrc"
|
||||
&& wget https://github.com/SagerNet/sing-box/releases/download/v1.10.3/sing-box-1.10.3-linux-amd64.tar.gz \
|
||||
&& tar -xf sing-box-1.10.3-linux-amd64.tar.gz \
|
||||
&& mv sing-box-1.10.3-linux-amd64/sing-box /usr/bin \
|
||||
&& rm sing-box-1.10.3-linux-amd64.tar.gz \
|
||||
&& rm -rf /sing-box-1.10.3-linux-amd64 \
|
||||
&& wget https://github.com/MetaCubeX/mihomo/releases/download/v1.18.10/mihomo-linux-amd64-v1.18.10.gz \
|
||||
&& gunzip mihomo-linux-amd64-v1.18.10.gz \
|
||||
&& mv mihomo-linux-amd64-v1.18.10 /usr/bin/mihomo
|
||||
@@ -1,3 +1,10 @@
|
||||
10.12.2024 v1.112
|
||||
- mihomo: встроенные списки теперь отдаются через rule-providers(т.е подгружаются ядром без обновления конфига)
|
||||
- обновлены ядра
|
||||
09.12.2024 v1.111
|
||||
- mihomo: фикс rule-providers format
|
||||
06.12.2024 v1.110
|
||||
- ruleset для mihomo
|
||||
28.11.2024 v1.109
|
||||
- фикс автоскана
|
||||
- добавление clash-шаблонов
|
||||
|
||||
Reference in New Issue
Block a user