Skip to content

Commit 4fab6c1

Browse files
authored
Merge pull request #28 from ladit/feature/singbox
feat: introduce sing-box support
2 parents 80cb854 + 577113d commit 4fab6c1

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

template/template/singbox.tpl

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
"dns": {
3+
"servers": [
4+
{
5+
"tag": "dnspod-doh",
6+
"address": "https://1.12.12.12/dns-query",
7+
"detour": "direct"
8+
},
9+
{
10+
"tag": "remote",
11+
"address": "fakeip"
12+
},
13+
{
14+
"tag": "block",
15+
"address": "rcode://success"
16+
}
17+
],
18+
"rules": [
19+
{
20+
"rule_set": "geosite-category-ads-all",
21+
"server": "block"
22+
},
23+
{
24+
"query_type": ["A", "AAAA"],
25+
"server": "remote"
26+
},
27+
{
28+
"outbound": "any",
29+
"server": "dnspod-doh"
30+
}
31+
],
32+
"fakeip": {
33+
"enabled": true,
34+
"inet4_range": "198.18.0.0/15",
35+
"inet6_range": "fc00::/18"
36+
},
37+
"independent_cache": true
38+
},
39+
"inbounds": [
40+
{
41+
"type": "tun",
42+
"inet4_address": "172.19.0.1/30",
43+
"inet6_address": "fdfe:dcba:9876::1/126",
44+
"auto_route": true,
45+
"strict_route": true,
46+
"sniff": true
47+
}
48+
],
49+
"outbounds": [
50+
{
51+
"type": "selector",
52+
"tag": "proxy",
53+
"outbounds": {{ getSingboxNodeNames(nodeList, null, ['auto']) | json }},
54+
"interrupt_exist_connections": false
55+
},
56+
{
57+
"type": "urltest",
58+
"tag": "auto",
59+
"outbounds": {{ getSingboxNodeNames(nodeList) | json }},
60+
"url": "{{ proxyTestUrl }}",
61+
"interrupt_exist_connections": false
62+
},
63+
{{ getSingboxNodesString(nodeList) }},
64+
{
65+
"type": "direct",
66+
"tag": "direct",
67+
"tcp_fast_open": true,
68+
"tcp_multi_path": true
69+
},
70+
{
71+
"type": "block",
72+
"tag": "block"
73+
},
74+
{
75+
"type": "dns",
76+
"tag": "dns"
77+
}
78+
],
79+
"route": {
80+
"rules": [
81+
{
82+
"type": "logical",
83+
"mode": "or",
84+
"rules": [
85+
{
86+
"protocol": "dns"
87+
},
88+
{
89+
"port": 53
90+
}
91+
],
92+
"outbound": "dns"
93+
},
94+
{
95+
"ip_is_private": true,
96+
"outbound": "direct"
97+
},
98+
{
99+
"clash_mode": "Direct",
100+
"outbound": "direct"
101+
},
102+
{
103+
"clash_mode": "Global",
104+
"outbound": "proxy"
105+
},
106+
{
107+
"geosite": "geosite-category-ads-all",
108+
"outbound": "block"
109+
},
110+
{
111+
"type": "logical",
112+
"mode": "and",
113+
"rules": [
114+
{
115+
"rule_set": "geosite-geolocation-!cn",
116+
"invert": true
117+
},
118+
{
119+
"rule_set": ["geoip-cn", "geosite-cn"]
120+
}
121+
],
122+
"outbound": "direct"
123+
}
124+
],
125+
"rule_set": [
126+
{
127+
"tag": "geosite-category-ads-all",
128+
"type": "remote",
129+
"format": "binary",
130+
"url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-category-ads-all.srs"
131+
},
132+
{
133+
"type": "remote",
134+
"tag": "geosite-geolocation-!cn",
135+
"format": "binary",
136+
"url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-geolocation-!cn.srs"
137+
},
138+
{
139+
"tag": "geosite-cn",
140+
"type": "remote",
141+
"format": "binary",
142+
"url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-cn.srs"
143+
},
144+
{
145+
"tag": "geoip-cn",
146+
"type": "remote",
147+
"format": "binary",
148+
"url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geoip@rule-set/geoip-cn.srs"
149+
}
150+
],
151+
"auto_detect_interface": true
152+
},
153+
"experimental": {
154+
"cache_file": {
155+
"enabled": true,
156+
"store_fakeip": true
157+
},
158+
"clash_api": {
159+
"external_controller": ":9090",
160+
"external_ui_download_url": "https://github.abskoop.workers.dev/https://github.com/MetaCubeX/metacubexd/archive/gh-pages.zip",
161+
"secret": "MY_PASSWORD"
162+
}
163+
}
164+
}

0 commit comments

Comments
 (0)