{
  "$schema": "https://sing-box.sagernet.org/schema.json",
  "log": {
    "level": "info",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "type": "https",
        "tag": "dns-cn",
        "server": "223.5.5.5",
        "server_port": 443,
        "path": "/dns-query",
        "tls": {
          "enabled": true,
          "server_name": "dns.alidns.com"
        },
        "detour": "direct"
      },
      {
        "type": "https",
        "tag": "dns-global",
        "server": "1.1.1.1",
        "server_port": 443,
        "path": "/dns-query",
        "tls": {
          "enabled": true,
          "server_name": "cloudflare-dns.com"
        },
        "detour": "proxy"
      }
    ],
    "rules": [
      {
        "rule_set": "geosite-cn",
        "action": "route",
        "server": "dns-cn"
      }
    ],
    "final": "dns-global",
    "strategy": "prefer_ipv4",
    "reverse_mapping": true
  },
  "http_clients": [
    {
      "tag": "rules-via-proxy",
      "detour": "proxy"
    }
  ],
  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "address": [
        "172.19.0.1/30",
        "fdfe:dcba:9876::1/126"
      ],
      "mtu": 1500,
      "auto_route": true,
      "strict_route": true,
      "dns_mode": "hijack",
      "stack": "mixed"
    }
  ],
  "outbounds": [
    {
      "type": "hysteria2",
      "tag": "proxy",
      "server": "修改为你的HY2服务器IP或域名",
      "server_port": 443,
      "password": "修改为你的HY2密码",
      "tls": {
        "enabled": true,
        "server_name": "修改为HY2证书的域名",
        "insecure": false,
        "alpn": [
          "h3"
        ]
      }
    },
    {
      "type": "direct",
      "tag": "direct",
      "domain_resolver": "dns-cn"
    }
  ],
  "route": {
    "rules": [
      {
        "inbound": "tun-in",
        "port": 53,
        "action": "hijack-dns"
      },
      {
        "action": "sniff"
      },
      {
        "protocol": "dns",
        "action": "hijack-dns"
      },
      {
        "ip_is_private": true,
        "action": "route",
        "outbound": "direct"
      },
      {
        "rule_set": "geosite-cn",
        "action": "route",
        "outbound": "direct"
      },
      {
        "rule_set": "geoip-cn",
        "action": "route",
        "outbound": "direct"
      }
    ],
    "rule_set": [
      {
        "type": "remote",
        "tag": "geosite-cn",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-cn.srs",
        "http_client": "rules-via-proxy",
        "update_interval": "1d",
        "initial_path": "rules/geosite-cn.srs"
      },
      {
        "type": "remote",
        "tag": "geoip-cn",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
        "http_client": "rules-via-proxy",
        "update_interval": "1d",
        "initial_path": "rules/geoip-cn.srs"
      }
    ],
    "final": "proxy",
    "auto_detect_interface": true,
    "default_http_client": "rules-via-proxy",
    "default_domain_resolver": "dns-global"
  },
  "experimental": {
    "cache_file": {
      "enabled": true,
      "path": "cache.db",
      "store_dns": false
    }
  }
}
