Skip to content

Commit

Permalink
fix: remove geosite download in sing-box
Browse files Browse the repository at this point in the history
  • Loading branch information
7Sageer committed Nov 20, 2024
1 parent 8241f10 commit 45855d2
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

## 最近更新

- 2024-11-19
- 改进了整体UI交互体验,提升了操作流畅度
- 2024-11-20
- 修复sing-box配置初次下载过慢的问题

[查看更新日志](/docs/update-log.md)

Expand Down
4 changes: 4 additions & 0 deletions docs/update-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 2024-11-20

- 修复sing-box配置初次下载过慢的问题

## 2024-11-19

- 改进了整体UI交互体验,提升了操作流畅度

## 2024-11-05
Expand Down
119 changes: 97 additions & 22 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ export const UNIFIED_RULES = [
site_rules: ['apple'],
ip_rules: []
},
{
name: 'Bahamut',
outbound: '🎮 巴哈姆特',
site_rules: ['bahamut'],
ip_rules: []
},

{
name: 'Social Media',
outbound: '🌐 社交媒体',
Expand All @@ -87,7 +80,7 @@ export const UNIFIED_RULES = [
{
name: 'Streaming',
outbound: '🎬 流媒体',
site_rules: ['netflix', 'hulu', 'disney', 'hbo', 'amazon'],
site_rules: ['netflix', 'hulu', 'disney', 'hbo', 'amazon','bahamut'],
ip_rules: []
},
{
Expand All @@ -113,13 +106,19 @@ export const UNIFIED_RULES = [
outbound: '☁️ 云服务',
site_rules: ['aws', 'azure', 'digitalocean', 'heroku', 'dropbox'],
ip_rules: []
},
{
name: 'Non-China',
outbound: '🌐 非中国',
site_rules: ['geolocation-!cn'],
ip_rules: []
}

];

export const PREDEFINED_RULE_SETS = {
minimal: ['Location:CN', 'Private'],
balanced: ['Location:CN', 'Private', 'Google', 'Youtube', 'AI Services', 'Telegram'],
minimal: ['Location:CN', 'Private', 'Non-China'],
balanced: ['Location:CN', 'Private', 'Non-China', 'Google', 'Youtube', 'AI Services', 'Telegram'],
comprehensive: UNIFIED_RULES.map(rule => rule.name)
};

Expand Down Expand Up @@ -242,9 +241,19 @@ export function generateRuleSets(selectedRules = [], customRules = []) {
type: 'remote',
format: 'binary',
url: `${IP_RULE_SET_BASE_URL}${IP_RULE_SETS[rule]}`,
download_detour: '⚡ 自动选择'
download_detour: '⚡ 自动选择'
}));

if(!selectedRules.includes('Non-China')){
site_rule_sets.push({
tag: 'geolocation-!cn',
type: 'remote',
format: 'binary',
url: `${SITE_RULE_SET_BASE_URL}geosite-geolocation-!cn.srs`,
download_detour: '⚡ 自动选择'
});
}

if(customRules){
customRules.forEach(rule => {
if(rule.site!=''){
Expand Down Expand Up @@ -281,23 +290,75 @@ export function generateRuleSets(selectedRules = [], customRules = []) {
export const SING_BOX_CONFIG = {
dns: {
servers: [
{ tag: 'dns_proxy', address: 'tls://1.1.1.1', address_resolver: 'dns_resolver' },
{ tag: 'dns_direct', address: 'h3://dns.alidns.com/dns-query', address_resolver: 'dns_resolver', detour: 'DIRECT' },
{ tag: 'dns_fakeip', address: 'fakeip' },
{ tag: 'dns_resolver', address: '223.5.5.5', detour: 'DIRECT' },
{ tag: 'dns_block', address: 'rcode://success' }
{
tag: "dns_proxy",
address: "tcp://1.1.1.1",
address_resolver: "dns_resolver",
strategy: "ipv4_only",
detour: "🚀 节点选择"
},
{
tag: "dns_direct",
address: "https://dns.alidns.com/dns-query",
address_resolver: "dns_resolver",
strategy: "ipv4_only",
detour: "DIRECT"
},
{
tag: "dns_resolver",
address: "223.5.5.5",
detour: "DIRECT"
},
{
tag: "dns_success",
address: "rcode://success"
},
{
tag: "dns_refused",
address: "rcode://refused"
},
{
tag: "dns_fakeip",
address: "fakeip"
}
],
rules: [
{ outbound: ['any'], server: 'dns_resolver' },
{ geosite: ['category-ads-all'], server: 'dns_block', disable_cache: true },
{ geosite: ['geolocation-!cn'], query_type: ['A', 'AAAA'], server: 'dns_fakeip' },
{ geosite: ['geolocation-!cn'], server: 'dns_proxy' }
{
outbound: "any",
server: "dns_resolver"
},
{
rule_set: "geolocation-!cn",
query_type: [
"A",
"AAAA"
],
server: "dns_fakeip"
},
{
rule_set: "geolocation-!cn",
query_type: [
"CNAME"
],
server: "dns_proxy"
},
{
query_type: [
"A",
"AAAA",
"CNAME"
],
invert: true,
server: "dns_refused",
disable_cache: true
}
],
final: 'dns_direct',
final: "dns_direct",
independent_cache: true,
fakeip: {
enabled: true,
inet4_range: '198.18.0.0/15'
inet4_range: "198.18.0.0/15",
inet6_range: "fc00::/18"
}
},
ntp: {
Expand All @@ -317,6 +378,20 @@ export const SING_BOX_CONFIG = {
{ type: 'dns', tag: 'dns-out' }
],
route : {
"rule_set": [
{
"tag": "geosite-geolocation-!cn",
"type": "local",
"format": "binary",
"path": "geosite-geolocation-!cn.srs"
}
],
rules: [
{
"outbound": "any",
"server": "dns_resolver"
}
]
},
experimental: {
cache_file: {
Expand Down

0 comments on commit 45855d2

Please sign in to comment.