Appearance
sing-box
是什么
sing-box 也是一款正向代理工具。相比 mihomo,支持更丰富的配置。
为什么
缺点:
- 不支持负载均衡,支持 urltest 伪负载均衡
- 配置项过于复杂,且经常变动,难以书写
优点:
- dns/route 等支持更加复杂的规则
- 性能好,路由比较快
如何使用
- 准备 sing-box 工作目录,下方所有文件都放入此目录
- 下载 sing-box 二进制 Releases,选择对应的版本,解压
- 准备 ip 数据库 cnip.srs MetaCubeX/meta-rules-dat
- 准备配置文件 config.json,从代理提供商订阅链接或其他方式获取
- 管理员模式启动终端(tun 模式必须),进入工作目录,运行
.\sing-box.exe run -D .启动
what

配置参考,基于 v1.12.3 版本
json
{
"log": {
"disabled": false,
"level": "debug",
"timestamp": true
},
"experimental": {
"cache_file": {
"enabled": true,
"store_rdrc": true
}
},
"inbounds": [
{
"tag": "mixed-in",
"type": "mixed",
"listen": "127.0.0.1",
"listen_port": 7890,
"tls": {
"enabled": false
},
"set_system_proxy": false
},
{
"tag": "tun-in",
"type": "tun",
"interface_name": "SingBoxTUN",
"address": [
"172.19.0.1/30",
"fdfe:dcba:9876::1/126"
],
"auto_route": true,
"strict_route": true,
"mtu": 9000,
"stack": "mixed"
}
],
"outbounds": [
{
"tag": "国内",
"type": "direct"
},
{
"tag": "国外",
"type": "selector",
"outbounds": [
"自动选择",
"⏳节点名"
]
},
{
"tag": "自动选择",
"type": "urltest",
"url": "http://www.msftconnecttest.com/connecttest.txt",
"outbounds": [
"⏳节点名",
]
},
{
"tag": "⏳节点名",
"type": "⏳",
"server": "⏳",
"server_port": ⏳,
"method": "⏳",
"password": "⏳"
},
],
"route": {
"auto_detect_interface": true,
"default_domain_resolver": "dnsproxy",
"final": "国外",
"rules": [
{
"action": "sniff"
},
{
"action": "hijack-dns",
"protocol": "dns"
},
{
"outbound": "国内",
"ip_is_private": true
},
{
"outbound": "国外",
"type": "logical",
"mode": "or",
"rules": [
{
"domain_suffix": [
"gstatic.com"
]
}
]
},
{
"outbound": "国外",
"rule_set": [
"geosite-geolocation-!cn"
]
},
{
"outbound": "国内",
"rule_set": [
"geosite-geolocation-cn",
"geoip-cn"
]
}
],
"rule_set": [
{
"tag": "geosite-geolocation-cn",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs",
"download_detour": "国外",
"update_interval": "3d"
},
{
"tag": "geosite-geolocation-!cn",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-!cn.srs",
"download_detour": "国外",
"update_interval": "3d"
},
{
"tag": "geoip-cn",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
"download_detour": "国外",
"update_interval": "3d"
}
]
},
"dns": {
"independent_cache": true,
"rules": [
{
"server": "fakeip",
"query_type": [
"A",
"AAAA"
]
}
],
"servers": [
{
"tag": "local",
"type": "local"
},
{
"tag": "dnsproxy",
"type": "udp",
"server": "unfiltered.adguard-dns.com",
"domain_resolver": "dnspod"
},
{
"tag": "dnspod",
"type": "udp",
"server": "119.29.29.29"
},
{
"tag": "fakeip",
"type": "fakeip",
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
}
]
}
}