Skip to content

Instantly share code, notes, and snippets.

@Chenx221
Last active September 8, 2024 06:50
Show Gist options
  • Save Chenx221/1ca6955bb42d1f8fd0b9ea8d521c9e00 to your computer and use it in GitHub Desktop.
Save Chenx221/1ca6955bb42d1f8fd0b9ea8d521c9e00 to your computer and use it in GitHub Desktop.
Self-use sing-box config
{
"log": {
"disabled": false,
"level": "info",
"timestamp": true
},
"experimental": {
"clash_api": {
"external_controller": "127.0.0.1:9090",
"external_ui": "metacubexd",
"external_ui_download_url": "https://git.chenx221.cyou/chenx221/metacubexd/archive/gh-pages.zip",
"external_ui_download_detour": "Selector",
"default_mode": "rule"
},
"cache_file": {
"enabled": true
}
},
"dns": {
"servers": [
{
"tag": "dns_proxy",
"address": "https://1.1.1.1/dns-query",
"address_resolver": "google",
"strategy": "ipv4_only",
"detour": "Selector"
},
{
"tag": "dns_direct",
"address": "h3://dns.alidns.com/dns-query",
"address_resolver": "dns_resolver",
"strategy": "ipv4_only",
"detour": "direct"
},
{
"tag": "google",
"address": "tls://8.8.4.4"
},
{
"tag": "dns_block",
"address": "rcode://success"
},
{
"tag": "dns_resolver",
"address": "114.114.114.114",
"strategy": "ipv4_only",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "dns_direct"
},
{
"clash_mode": "direct",
"server": "dns_direct"
},
{
"clash_mode": "global",
"server": "dns_proxy"
},
{
"rule_set": "geosite-cn",
"server": "dns_direct"
},
{
"rule_set": "geoip-cn",
"server": "dns_direct"
},
{
"rule_set": "geosite-geolocation-!cn",
"server": "dns_proxy"
}
],
"independent_cache": true,
"final": "dns_direct"
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"stack": "system",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"strict_route": true,
"sniff": true,
"platform": {
"http_proxy": {
"enabled": true,
"server": "127.0.0.1",
"server_port": 1082
}
},
// "route_exclude_address": ["94.140.14.247/32"] Since sing-box 1.10.0
"inet4_route_exclude_address": ["94.140.14.247/32"] // Deprecated in sing-box 1.10.0
},
{
"type": "mixed",
"listen": "127.0.0.1",
"listen_port": 1082,
"sniff": true,
"users": []
},
{
"type": "socks",
"tag": "socks-in",
"listen": "127.0.0.1",
"listen_port": 7888
}
],
"outbounds": [
{
"type": "selector",
"tag": "Selector",
"outbounds": [
"direct",
<节点tag>
]
},
{
"type": "selector",
"tag": "LocalDirect",
"outbounds": ["direct"],
"default": "direct"
},
{
"type": "selector",
"tag": "reject",
"outbounds": ["block"],
"default": "block"
},
{
"tag": "direct",
"type": "direct"
},
{
"tag": "block",
"type": "block"
},
{
"tag": "dns",
"type": "dns"
},
<节点信息>
],
"route": {
"rule_set": [
{
"tag": "geosite-telegram",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/telegram.srs",
"update_interval": "1d"
},
{
"tag": "geoip-telegram",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geoip/telegram.srs",
"update_interval": "1d"
},
{
"tag": "geosite-openai",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/openai.srs",
"update_interval": "1d"
},
{
"tag": "geosite-google",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/google.srs",
"update_interval": "1d"
},
{
"tag": "geosite-google@cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/[email protected]",
"update_interval": "1d"
},
{
"tag": "geoip-google",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geoip/google.srs",
"update_interval": "1d"
},
{
"tag": "geosite-gfw",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/gfw.srs",
"update_interval": "1d"
},
{
"tag": "geosite-microsoft@cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/[email protected]",
"update_interval": "1d"
},
{
"tag": "geosite-onedrive",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/onedrive.srs",
"update_interval": "1d"
},
{
"tag": "geosite-steam",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/steam.srs",
"update_interval": "1d"
},
{
"tag": "geosite-steam@cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/[email protected]",
"update_interval": "1d"
},
{
"tag": "geosite-geolocation-!cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/geolocation-%21cn.srs",
"update_interval": "1d"
},
{
"tag": "geosite-category-games@cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/[email protected]",
"update_interval": "1d"
},
{
"tag": "geosite-private",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/private.srs",
"update_interval": "1d"
},
{
"tag": "geosite-cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geosite/cn.srs",
"update_interval": "1d"
},
{
"tag": "geoip-private",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geoip/private.srs",
"update_interval": "1d"
},
{
"tag": "geoip-cn",
"type": "remote",
"format": "binary",
"url": "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/sing/geo/geoip/cn.srs",
"update_interval": "1d"
}
],
"rules": [
{
"clash_mode": "global",
"outbound": "Selector"
},
{
"clash_mode": "direct",
"outbound": "LocalDirect"
},
{
"protocol": "dns",
"outbound": "dns"
},
{
"type": "logical",
"mode": "or",
"rules": [
{
"domain_regex": "^stun\\..+"
},
{
"domain_keyword": ["stun", "httpdns"]
},
{
"protocol": "stun"
}
],
"outbound": "block"
},
{
"domain_suffix": [
"g3.letv.com",
"git.chenx221.cyou",
"local.adguard.org"
],
"outbound": "LocalDirect"
},
{
"rule_set": [
"geosite-google@cn",
"geosite-microsoft@cn",
// "geosite-onedrive",
"geosite-steam@cn",
"geosite-category-games@cn"
],
"outbound": "LocalDirect"
},
{
"rule_set": [
"geosite-google",
"geoip-google",
"geosite-gfw",
"geosite-steam"
],
"outbound": "Selector"
},
{
"rule_set": [
"geosite-telegram",
"geoip-telegram",
"geosite-openai",
"geosite-geolocation-!cn"
],
"outbound": "Selector"
},
{
"rule_set": [
"geosite-private",
"geosite-cn",
"geoip-private",
"geoip-cn"
],
"outbound": "LocalDirect"
}
],
"final": "Selector",
"auto_detect_interface": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment