From d6ce3c39bc410aaee6efb90b4c6a0f8a6b7f0f03 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:39:38 +0800 Subject: [PATCH 01/10] (sing-box)fakeip --- config/appprofile.example.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index 483d5d133c..0f3580f279 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -67,7 +67,7 @@ 'address' => 'tls://one.one.one.one', 'address_resolver' => 'resolver', 'address_strategy' => 'ipv4_only', - 'strategy' => 'prefer_ipv6', + 'strategy' => 'prefer_ipv4', 'detour' => 'select', ], [ @@ -86,12 +86,11 @@ ], [ 'clash_mode' => 'Global', - 'server' => 'cloudflare', + 'server' => 'fakeip', ], [ 'clash_mode' => 'Rule', - 'rule_set' => 'geosite-geolocation-!cn', - 'server' => 'cloudflare', + 'server' => 'fakeip', ], [ 'clash_mode' => 'Rule', From 73a4fd70bb24e8abe72f0f6e50f3db6fe18eb7e0 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:40:42 +0800 Subject: [PATCH 02/10] Update appprofile.example.php --- config/appprofile.example.php | 38 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index 0f3580f279..96f36de1cd 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -70,6 +70,14 @@ 'strategy' => 'prefer_ipv4', 'detour' => 'select', ], + [ + 'tag' => 'google', + 'address' => 'tls://dns.google', + 'address_resolver' => 'resolver', + 'address_strategy' => 'ipv4_only', + 'strategy' => 'prefer_ipv4', + 'detour' => 'select', + ], [ 'tag' => 'fakeip', 'address' => 'fakeip', @@ -92,17 +100,12 @@ 'clash_mode' => 'Rule', 'server' => 'fakeip', ], - [ - 'clash_mode' => 'Rule', - 'rule_set' => 'geosite-cn', - 'server' => 'fakeip', - ], [ 'clash_mode' => 'Direct', 'server' => 'local', ], ], - 'final' => 'cloudflare', + 'final' => 'block', 'fakeip' => [ 'enabled' => true, 'inet4_range' => '198.18.0.0/15', @@ -175,11 +178,24 @@ [ 'clash_mode' => 'Rule', 'rule_set' => [ - 'geosite-cn', 'geoip-cn', ], 'outbound' => 'direct', ], + [ + 'clash_mode' => 'Rule', + 'rule_set' => [ + 'geosite-geolocation-cn', + ], + 'outbound' => 'direct', + ], + [ + 'clash_mode' => 'Rule', + 'rule_set' => [ + 'geosite-cn', + ], + 'outbound' => 'direct', + ], [ 'clash_mode' => 'Global', 'outbound' => 'select', @@ -211,6 +227,14 @@ 'download_detour' => 'auto', 'update_interval' => '1d', ], + [ + 'tag' => 'geosite-geolocation-cn', + 'type' => 'remote', + 'format' => 'binary', + 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-geolocation-cn.srs', + 'download_detour' => 'auto', + 'update_interval' => '1d', + ], [ 'tag' => 'geosite-geolocation-!cn', 'type' => 'remote', From 5ce7d9de7eaf17c9f586e9ca4516a6e2b67f5ae3 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:14:45 +0800 Subject: [PATCH 03/10] (update)sing-box rule --- config/appprofile.example.php | 79 ++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index 96f36de1cd..38b59d9144 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -57,26 +57,23 @@ 'detour' => 'direct', ], [ - 'tag' => 'resolver', + 'tag' => 'alidns', 'address' => 'quic://223.6.6.6', - 'strategy' => 'ipv4_only', 'detour' => 'direct', ], [ 'tag' => 'cloudflare', - 'address' => 'tls://one.one.one.one', - 'address_resolver' => 'resolver', - 'address_strategy' => 'ipv4_only', - 'strategy' => 'prefer_ipv4', + 'address' => 'tls://1.1.1.1', 'detour' => 'select', ], [ 'tag' => 'google', 'address' => 'tls://dns.google', - 'address_resolver' => 'resolver', + 'address_resolver' => 'alidns', 'address_strategy' => 'ipv4_only', 'strategy' => 'prefer_ipv4', 'detour' => 'select', + 'client_subnet' => '111.222.0.0', ], [ 'tag' => 'fakeip', @@ -96,9 +93,26 @@ 'clash_mode' => 'Global', 'server' => 'fakeip', ], + [ + 'query_type' => [ + 'SVCB', + 'HTTPS', + ], + 'server' => 'block', + ], + [ + 'rule_set' => [ + 'china-site', + 'geosite-geolocation-cn', + 'geosite-cn', + 'geosite-netease', + 'geosite-bilibili', + ], + 'server' => 'local', + ], [ 'clash_mode' => 'Rule', - 'server' => 'fakeip', + 'server' => 'cloudflare', ], [ 'clash_mode' => 'Direct', @@ -169,31 +183,44 @@ 'outbound' => 'direct', ], [ - 'clash_mode' => 'Rule', 'rule_set' => [ 'geosite-geolocation-!cn', ], 'outbound' => 'select', ], [ - 'clash_mode' => 'Rule', 'rule_set' => [ 'geoip-cn', ], 'outbound' => 'direct', ], [ - 'clash_mode' => 'Rule', 'rule_set' => [ + 'china-site', 'geosite-geolocation-cn', + 'geosite-cn', + 'geosite-netease', + 'geosite-bilibili', ], 'outbound' => 'direct', ], [ - 'clash_mode' => 'Rule', - 'rule_set' => [ - 'geosite-cn', + 'type' => 'logical', + 'mode' => 'and', + 'rules' => [ + [ + 'rule_set' => [ + 'geosite-geolocation-!cn', + ], + 'invert' => true, + ], + [ + 'rule_set' => [ + 'geoip-cn', + ], + ] ], + 'action' => 'route', 'outbound' => 'direct', ], [ @@ -227,6 +254,14 @@ 'download_detour' => 'auto', 'update_interval' => '1d', ], + [ + 'tag' => 'china-site', + 'type' => 'remote', + 'format' => 'binary', + 'url' => 'https://github.com/77-QiQi/sing-box-rule-set/releases/download/china-rule-set/china_site.srs', + 'download_detour' => 'auto', + 'update_interval' => '1d', + ], [ 'tag' => 'geosite-geolocation-cn', 'type' => 'remote', @@ -243,6 +278,22 @@ 'download_detour' => 'auto', 'update_interval' => '1d', ], + [ + 'tag' => 'geosite-netease', + 'type' => 'remote', + 'format' => 'binary', + 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-netease.srs', + 'download_detour' => 'auto', + 'update_interval' => '1d', + ], + [ + 'tag' => 'geosite-bilibili', + 'type' => 'remote', + 'format' => 'binary', + 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-bilibili.srs', + 'download_detour' => 'auto', + 'update_interval' => '1d', + ], ], 'final' => 'select', 'auto_detect_interface' => true, From 0b0595604e6f15fab9acb70fa88e8c4b179cf619 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:31:57 +0800 Subject: [PATCH 04/10] fix: typo --- config/appprofile.example.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index 38b59d9144..c8b136f323 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -218,7 +218,7 @@ 'rule_set' => [ 'geoip-cn', ], - ] + ], ], 'action' => 'route', 'outbound' => 'direct', From 8a323539728805180dca915fa82671d8b8db3e93 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:50:34 +0800 Subject: [PATCH 05/10] fix: typo --- config/appprofile.example.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index c8b136f323..620285dc5a 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -182,6 +182,10 @@ 'clash_mode' => 'Direct', 'outbound' => 'direct', ], + [ + 'clash_mode' => 'Global', + 'outbound' => 'select', + ], [ 'rule_set' => [ 'geosite-geolocation-!cn', @@ -223,10 +227,6 @@ 'action' => 'route', 'outbound' => 'direct', ], - [ - 'clash_mode' => 'Global', - 'outbound' => 'select', - ], [ 'protocol' => 'stun', 'action' => 'reject', From eea37df0ce99dce94399b66b8bca6e4e6ce58efb Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sun, 22 Dec 2024 02:40:55 +0800 Subject: [PATCH 06/10] fix: typo --- config/appprofile.example.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index 620285dc5a..babbbaf52e 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -95,6 +95,8 @@ ], [ 'query_type' => [ + 'A', + 'AAAA', 'SVCB', 'HTTPS', ], From df76f39534986e6291bedf9e7b7551dff5defa56 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sun, 22 Dec 2024 04:23:21 +0800 Subject: [PATCH 07/10] fix: typo --- config/appprofile.example.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index babbbaf52e..b3313bdb3d 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -95,8 +95,6 @@ ], [ 'query_type' => [ - 'A', - 'AAAA', 'SVCB', 'HTTPS', ], @@ -136,7 +134,7 @@ 'tag' => 'in', 'address' => [ '172.18.0.1/30', - 'fdfe:dcba:9876::1/126', + //'fdfe:dcba:9876::1/126', ], 'auto_route' => true, 'strict_route' => true, From d98ff5972e882f0624c5b9c8bad223acc8de1109 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Sun, 22 Dec 2024 06:12:03 +0800 Subject: [PATCH 08/10] fix: update --- config/appprofile.example.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/appprofile.example.php b/config/appprofile.example.php index b3313bdb3d..620285dc5a 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -134,7 +134,7 @@ 'tag' => 'in', 'address' => [ '172.18.0.1/30', - //'fdfe:dcba:9876::1/126', + 'fdfe:dcba:9876::1/126', ], 'auto_route' => true, 'strict_route' => true, From f6d8ed29ac204778fbbd78638ba6a5fad73dd7eb Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Fri, 27 Dec 2024 16:30:57 +0800 Subject: [PATCH 09/10] (Clash subscribe fix)UDP over TCP --- src/Services/Subscribe/Clash.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Services/Subscribe/Clash.php b/src/Services/Subscribe/Clash.php index 4e7fda11d7..61d3fec0d8 100644 --- a/src/Services/Subscribe/Clash.php +++ b/src/Services/Subscribe/Clash.php @@ -58,6 +58,7 @@ public function getContent($user): string // Clash 特定配置 $udp = $node_custom_config['udp'] ?? true; $server_key = $node_custom_config['server_key'] ?? ''; + $uot = $node_custom_config['uot'] ?? false; $node = [ 'name' => $node_raw->name, @@ -67,6 +68,7 @@ public function getContent($user): string 'password' => $server_key === '' ? $user_pk : $server_key . ':' .$user_pk, 'cipher' => $method, 'udp' => (bool) $udp, + 'udp_over_tcp' => (bool) $uot, ]; break; From 224f9518f83707f0aded1a7750e97068884c2239 Mon Sep 17 00:00:00 2001 From: 77-QiQi <87052253+77-QiQi@users.noreply.github.com> Date: Fri, 27 Dec 2024 16:31:41 +0800 Subject: [PATCH 10/10] (SingBox subscribe fix)UDP over TCP --- src/Services/Subscribe/SingBox.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Services/Subscribe/SingBox.php b/src/Services/Subscribe/SingBox.php index 5d11ea46ae..73893b8aac 100644 --- a/src/Services/Subscribe/SingBox.php +++ b/src/Services/Subscribe/SingBox.php @@ -39,6 +39,7 @@ public function getContent($user): string ($node_custom_config['offset_port_node'] ?? 443); $method = $node_custom_config['method'] ?? '2022-blake3-aes-128-gcm'; $user_pk = Tools::genSs2022UserPk($user->passwd, $method); + $uot = $node_custom_config['uot'] ?? false; if (! $user_pk) { $node = []; @@ -54,6 +55,7 @@ public function getContent($user): string 'server_port' => (int) $ss_2022_port, 'method' => $method, 'password' => $server_key === '' ? $user_pk : $server_key . ':' .$user_pk, + 'udp_over_tcp' => (bool) $uot, ]; break;