Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uim] (update)sing-box rule #2495

Open
wants to merge 7 commits into
base: uim
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/.config.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,14 @@
$_ENV['r2_client_download_timeout'] = 10;
// Clash Meta TCP Concurrency. Default true, false
$_ENV['tcp_concurrent'] = true;
// Custom DNS, sing-box DNS Server setting(Rule mode). tls / https / quic / h3
$_ENV['dns_select'] = 'mine_853'; //Default mine_853, mine_443, google, cloudflare, opendns, alidns
//mine_853 default type tls, quic
$_ENV['dns_server_853'] = 'dns.google'; //The address of the DNS server. Default domain, ip
$_ENV['dns_server_port_853'] = 853; //The port of the DNS server. Default 853
$_ENV['dns_type_853'] = 'tls'; //The type of the DNS server. Default tls, quic
//mine_443 default type https, h3
$_ENV['dns_server_443'] = 'dns.google'; //The address of the DNS server. Default domain, ip
$_ENV['dns_server_port_443'] = 443; //The port of the DNS server. Default 443
$_ENV['dns_path_443'] = '/dns-query'; //The path of the DNS server. Default /dns-query
$_ENV['dns_type_443'] = 'https'; //The type of the DNS server. Default https, h3
140 changes: 98 additions & 42 deletions config/appprofile.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,46 +68,68 @@
'type' => 'tls',
'server' => '1.1.1.1',
'server_port' => 853,
'detour' => 'select',
'detour' => 'rules_dns_detour',
],
[
'tag' => 'google',
'type' => 'tls',
'server' => '8.8.4.4',
'server' => '8.8.8.8',
'server_port' => 853,
'detour' => 'direct',
'detour' => 'rules_dns_detour',
],
[
'tag' => 'opendns',
'type' => 'tls',
'server' => '208.67.222.222',
'server_port' => 853,
'detour' => 'rules_dns_detour',
],
[
'tag' => 'mine_853',
'type' => $_ENV['dns_type_853'],
'server' => $_ENV['dns_server_853'],
'server_port' => $_ENV['dns_server_port_853'],
'domain_resolver' => 'alidns',
'detour' => 'rules_dns_detour',
],
[
'tag' => 'mine_443',
'type' => $_ENV['dns_type_443'],
'server' => $_ENV['dns_server_443'],
'server_port' => $_ENV['dns_server_port_443'],
'path' => $_ENV['dns_path_443'],
'domain_resolver' => 'alidns',
'detour' => 'rules_dns_detour',
],
[
'tag' => 'fakeip',
'type' => 'fakeip',
'inet4_range' => '198.18.0.0/15',
'inet6_range' => 'fc00::/18',
],
[
'tag' => 'block',
'type' => 'predefined',
'responses' => [
[
'rcode' => 'REFUSED',
],
],
],
],
'rules' => [
[
'query_type' => [
'SVCB',
'HTTPS',
],
'server' => 'block',
'action' => 'predefined',
'rcode' => 'REFUSED',
],
[
'rule_set' => [
'geosite-category-ads-all',
],
'action' => 'predefined',
'rcode' => 'REFUSED',
],
[
'clash_mode' => 'Global',
'server' => 'fakeip',
],
[
'rule_set' => [
'china-site',
'geosite-geolocation-cn',
'geosite-cn',
'geosite-netease',
Expand All @@ -132,15 +154,10 @@
],
],
'action' => 'route',
'server' => 'google',
'server' => $_ENV['dns_select'],
'disable_cache' => true,
'client_subnet' => '111.222.0.0',
],
[
'rule_set' => [
'china-site-add',
],
'server' => 'fakeip',
],
[
'clash_mode' => 'Rule',
'server' => 'fakeip',
Expand All @@ -150,7 +167,7 @@
'server' => 'local',
],
],
'final' => 'block',
'final' => 'cloudflare',
'disable_cache' => true,
'independent_cache' => true,
],
Expand Down Expand Up @@ -188,6 +205,17 @@
'idle_timeout' => '30m',
'interrupt_exist_connections' => true,
],
[
'tag' => 'rules_dns_detour',
'type' => 'selector',
'outbounds' => [
'select',
'auto',
'direct',
],
'default' => 'select',
'interrupt_exist_connections' => true,
],
[
'tag' => 'rules_download',
'type' => 'selector',
Expand Down Expand Up @@ -215,6 +243,13 @@
'protocol' => 'dns',
'action' => 'hijack-dns',
],
[
'rule_set' => [
'geosite-category-ads-all',
],
'action' => 'reject',
'method' => 'default',
],
[
'clash_mode' => 'Direct',
'outbound' => 'direct',
Expand All @@ -223,28 +258,63 @@
'clash_mode' => 'Global',
'outbound' => 'select',
],
[
'protocol' => 'stun',
'action' => 'reject',
'method' => 'default',
],
[
'rule_set' => [
'geosite-geolocation-!cn',
],
'outbound' => 'select',
],
//[
//'action' => 'resolve',
//'server' => $_ENV['dns_select'],
//'disable_cache' => true,
//'rewrite_ttl' => 60,
//'client_subnet' => '111.222.0.0',
//],
[
'rule_set' => [
'geoip-cn',
'type' => 'logical',
'mode' => 'and',
'rules' => [
[
'rule_set' => [
'geosite-geolocation-!cn',
'geosite-geolocation-cn',
'geosite-cn',
'geosite-netease',
'geosite-bilibili',
],
'invert' => true,
],
[
'rule_set' => [
'geoip-cn',
],
'invert' => true,
],
],
'outbound' => 'direct',
'action' => 'route',
'outbound' => 'select',
],
[
'rule_set' => [
'china-site',
'geosite-geolocation-cn',
'geosite-cn',
'geosite-netease',
'geosite-bilibili',
],
'outbound' => 'direct',
],
[
'rule_set' => [
'geoip-cn',
],
'outbound' => 'direct',
],
[
'type' => 'logical',
'mode' => 'and',
Expand All @@ -264,11 +334,6 @@
'action' => 'route',
'outbound' => 'direct',
],
[
'protocol' => 'stun',
'action' => 'reject',
'method' => 'default',
],
[
'ip_is_private' => true,
'outbound' => 'direct',
Expand All @@ -292,18 +357,10 @@
'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' => 'rules_download',
'update_interval' => '1d',
],
[
'tag' => 'china-site-add',
'tag' => 'geosite-category-ads-all',
'type' => 'remote',
'format' => 'binary',
'url' => 'https://github.com/77-QiQi/sing-box-rule-set/releases/download/china-rule-set/china_site_add.srs',
'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-category-ads-all.srs',
'download_detour' => 'rules_download',
'update_interval' => '1d',
],
Expand Down Expand Up @@ -346,7 +403,6 @@
'default_domain_resolver' => [
'server' => 'local',
'rewrite_tll' => 60,
'client_subnet' => '111.222.0.0',
],
],
'experimental' => [
Expand Down