Compare commits

..

2 Commits

Author SHA1 Message Date
mercury 3e53000065 update version 2024-12-10 17:16:05 +04:00
mercury 18ceb51f4e mihomo: rules -> rule-providers
update core's
2024-12-10 17:13:38 +04:00
5 changed files with 103 additions and 39 deletions
+56 -2
View File
@@ -6138,7 +6138,8 @@ DNS-over-HTTPS with IP:
}
break;
case 'cl':
$c = $this->clashRuleSet($c);
$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) {
@@ -6158,7 +6159,60 @@ DNS-over-HTTPS with IP:
echo json_encode($c);
}
public function clashRuleSet($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']) {
+30 -24
View File
@@ -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,
@@ -91,33 +91,39 @@
}
],
"add-rule-providers": true,
"rule-providers": {},
"rules": [
{
"type": "DOMAIN-SUFFIX",
"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"
+2 -2
View File
@@ -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
View File
@@ -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
+3
View File
@@ -1,3 +1,6 @@
10.12.2024 v1.112
- mihomo: встроенные списки теперь отдаются через rule-providers(т.е подгружаются ядром без обновления конфига)
- обновлены ядра
09.12.2024 v1.111
- mihomo: фикс rule-providers format
06.12.2024 v1.110