From e1f14d85e0f279530fa487cc54c9b0c0a5badb50 Mon Sep 17 00:00:00 2001 From: mercury Date: Sun, 13 Oct 2024 23:58:02 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BC=D0=B0=D1=80=D1=88?= =?UTF-8?q?=D1=80=D1=83=D1=82=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20singbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/bot.php | 37 +++++++++++++++++++++++++++++++------ config/sing.json | 10 ++++++++++ version | 2 ++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/app/bot.php b/app/bot.php index dfe956b..1f24a27 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4982,6 +4982,7 @@ DNS-over-HTTPS with IP: $c['route']['rules'] = array_values($c['route']['rules']); $c['route'] = $this->addRuleSet($c['route']); $c['route'] = $this->addPackageRule($c['route']); + $c['route'] = $this->addProcessRule($c['route']); $c['route'] = $this->createRuleSet($c['route'], $uid, $domain); $c['route'] = $this->clearEmptyRules($c['route']); break; @@ -5004,12 +5005,36 @@ DNS-over-HTTPS with IP: public function addPackageRule($route) { - $p = $this->getPacConf(); - if (!empty($t = array_filter($p['packagelist'] ?: []))) { - $route['rules'][] = [ - 'package_name' => array_keys($t), - 'outbound' => $p['app_outbound'] ? 'direct' : 'proxy', - ]; + foreach ($route['rules'] as $k => $v) { + if (array_key_exists('package_name', $v)) { + $p = $this->getPacConf(); + if (!empty($t = array_filter($p['packagelist'] ?: []))) { + $route['rules'][$k] = [ + 'package_name' => array_keys($t), + 'outbound' => $p['app_outbound'] ? 'direct' : 'proxy', + ]; + } else { + unset($route['rules'][$k]); + } + } + } + return $route; + } + + public function addProcessRule($route) + { + foreach ($route['rules'] as $k => $v) { + if (array_key_exists('process_name', $v)) { + $p = $this->getPacConf(); + if (!empty($t = array_filter($p['processlist'] ?: []))) { + $route['rules'][$k] = [ + 'process_name' => array_keys($t), + 'outbound' => $p['process_outbound'] ? 'direct' : 'proxy', + ]; + } else { + unset($route['rules'][$k]); + } + } } return $route; } diff --git a/config/sing.json b/config/sing.json index bc5d67a..230b285 100644 --- a/config/sing.json +++ b/config/sing.json @@ -110,6 +110,16 @@ "protocol": "dns", "outbound": "dns-out" }, + { + "package_name": [ + ], + "outbound": "proxy" + }, + { + "process_name": [ + ], + "outbound": "proxy" + }, { "createruleset": [ { diff --git a/version b/version index 8bbac17..9740048 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +13.10.2024 v1.66 +- singbox template: изменен порядок правил маршрутизации для package_name 10.10.2024 v1.65.1 - фикс создания архива windows service singbox 2 09.10.2024 v1.65