根据sing-box的配置文档,以下是一个1.12版本的用于客户端的配置文件,满足您的需求:
{
"log": {
"level": "info",
"timestamp": true
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"interface_name": "tun0",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"strict_route": true,
"sniff": true
}
],
"outbounds": [
{
"type": "hysteria2",
"tag": "proxy",
"server": "你的服务器地址",
"server_port": 443,
"up_mbps": 50,
"down_mbps": 100,
"password": "你的密码",
"sni": "你的SNI",
"skip_cert_verify": false,
"alpn": ["h3"]
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
}
],
"route": {
"rules": [
{
"geosite": "category-ads-all",
"outbound": "block"
},
{
"geosite": "cn",
"geoip": "cn",
"outbound": "direct"
},
{
"geosite": "geolocation-!cn",
"outbound": "proxy"
}
],
"auto_detect_interface": true
},
"dns": {
"servers": [
{
"tag": "dns-direct",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
},
{
"tag": "dns-proxy",
"address": "https://8.8.8.8/dns-query",
"detour": "proxy"
}
],
"rules": [
{
"geosite": "cn",
"server": "dns-direct"
},
{
"geosite": "geolocation-!cn",
"server": "dns-proxy"
}
],
"strategy": "prefer_ipv4"
}
}
请注意替换以下内容:
你的服务器地址:你的Hysteria2服务器地址。
你的密码:你的Hysteria2密码。
你的SNI:你的Hysteria2 SNI。
这个配置:
- 使用TUN作为入站协议。
- 使用Hysteria2作为出站协议连接到你的服务器。
- 使用国内DNS(223.5.5.5)进行直连域名的解析,使用Google DNS(8.8.8.8)进行代理域名的解析。
- 配置了广告过滤,会将广告域名解析到
block出站。
- 根据域名和IP的地理位置进行路由分流,国内流量直连,国外流量通过Hysteria2代理。