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
},
"inbounds": [
{
"tag": "proxy-in",
"multiplex": { // 多路复用,仅限部分代理
"enabled": true
// 其他字段
}
// 其他入站
],
"outbounds": [
{
"type": "direct",
"tag": "direct-out"
}
// 其他出站配置,比如 warp...
],
"route": {
"rules": [
// ...一些路由规则
],
"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"
}
]
}
}
$ watch -n 1 "nstat -az | grep TcpExtTCPFastOpen"
...
TcpExtTCPFastOpenActive 16605 0.0
TcpExtTCPFastOpenActiveFail 12 0.0
TcpExtTCPFastOpenPassive 0 0.0
TcpExtTCPFastOpenPassiveFail 0 0.0
TcpExtTCPFastOpenListenOverflow 0 0.0
TcpExtTCPFastOpenCookieReqd 0 0.0
TcpExtTCPFastOpenBlackhole 0 0.0
TcpExtTCPFastOpenPassiveAltKey 0 0.0
客户端配置(仅适用于 Linux,Windows 等其他平台需要关闭 auto_redirect 相关设置):
{
"log": {
"level": "warn"
},
"dns": {
"servers": [
{
"tag": "dns-remote",
"type": "https", // 强烈建议远程 dns 使用 doh 以获得更好的性能,如果代理有原生 udp 能力可以考虑使用 h3(有可能降速)
"server": "8.8.4.4",
"tls": {
"enabled": true,
"server_name": "dns.google"
},
"detour": "proxy"
},
{
"tag": "dns-local",
"type": "h3",
"server": "223.5.5.5",
"tls": {
"enabled": true,
"server_name": "dns.alidns.com"
}
}
],
"rules": [ // dns 分流规则
{
"rule_set": ["cn-site", "cn-location"]
"server": "dns-local"
}
],
"optimistic": {
"enabled": true
}
},
"http_clients": [
{
"tag": "go"
}
],
"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
}
],
"outbounds": [
{
"tag": "proxy",
// ...其他字段
"multiplex": {
"enabled": true
}
},
{
"tag": "direct",
"type": "direct"
}
],
"route": {
"rules": [
{
"network": ["icmp"],
"outbound": "direct"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"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": "5d"
},
{
"type": "remote",
"tag": "cn-ip",
"format": "binary",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geoip/cn.srs",
"update_interval": "7d"
},
{
"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...