sing-box 客户端 + 服务端配置参考¶
折腾一下 sing-box,这样的话就只有 mihomo 不会用了(
警告
以下配置可能无法满足您的需求
服务端配置(移除注释):
{
"log": {
"level": "warn",
"output": "/var/log/sing-box/box.log", // 日志位置,不需要可删除
// 注意: 自定义日志位置需要确保 sing-box 可访问
// sing-box 默认工作路径是 /var/lib/sing-box
"timestamp": true
},
"dns": {
"servers": [
{
"type": "local",
"tag": "local-dns"
}
]
},
"inbounds": [
{
"tag": "proxy-in",
"multiplex": { // 多路复用,仅限部分代理
"enabled": true
// 其他字段
}
// 其他入站
],
"outbounds": [
{
"type": "direct",
"tag": "direct-out"
}
// 其他出站配置,比如 warp...
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"action": "resolve"
},
{
"protocol": ["bittorrent", "quic"], // 屏蔽 quic,不需要可删除
"action": "reject"
},
// ...其他路由规则
],
"rule_set": [
// 一些规则集,屏蔽还是走其他出站自己配置
{
"type": "remote",
"tag": "cn-site",
"format": "binary",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/cn.srs",
"update_interval": "7d"
},
{
"type": "remote",
"tag": "cn-ip",
"format": "binary",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geoip/cn.srs",
"update_interval": "7d"
}
]
}
}
不推荐 TFO 是因为多路复用性价比更高,对应 sing-box 的 multiplex 字段,其他代理自带的 mux 不推荐用,比如 naive 和 anytls。
客户端配置:
{
"log": {
"level": "warn"
},
"certificate": { "store": "mozilla" }, // 使用 mozilla 证书集合
"dns": {
"servers": [
{
"tag": "dns-remote",
"type": "tcp",
"server": "1.1.1.1",
"detour": "proxy"
},
{
"domain_resolver": "dns-local",
"path": "dns-query",
"server": "dns.alidns.com",
"tag": "dns-direct",
"type": "https"
},
{
"tag": "dns-local",
"type": "local"
}
],
"rules": [ // dns 分流规则
{
"type": "logical",
"mode": "or",
"rules": [
{
"domain": ["example.com"] // 额外添加域名走 dns-direct
},
{
"rule_set": ["cn-site", "cn-location"]
}
],
"server": "dns-direct"
}
]
},
"inbounds": [
{
"type": "tun",
"address": ["172.19.0.1/30", "fdfe:dcba:9876::1/126"],
"mtu": 9000,
"stack": "system",
"auto_route": true,
"auto_redirect": true,
"route_exclude_address_set": ["cnip"],
"strict_route": true
},
{
"type": "mixed", // 留一个 mixed 给浏览器用
"listen": "127.0.0.1",
"listen_port": 1080
}
],
"outbounds": [
{
"tag": "proxy",
// ...其他字段
"multiplex": {
"enabled": true
}
},
{
"tag": "direct",
"type": "direct"
}
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
},
{
"rule_set": ["cn-location", "cn-site"],
"outbound": "direct"
}
//...其他规则
],
"rule_set": [
{
"type": "remote",
"tag": "cn-site",
"format": "binary",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo-lite/geosite/cn.srs",
"update_interval": "2d"
},
{
"format": "binary",
"tag": "cn-location",
"type": "remote",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/geolocation-cn.srs",
"update_interval": "7d"
}
],
"default_domain_resolver": {
"server": "dns-remote"
},
"auto_detect_interface": true
},
"experimental": {
"cache_file": {
"enabled": true
}
}
}
Loading Comments...