网上有不少box4magisk的配置示例,但大多使用的sing-box核心。这里记录一下ai协助下修改后可用的一个xray核心配置示例,核心是inbounds开tproxy-in让流量进入,同时配置好DNS。

json 复制代码
{
  "log": {
    "loglevel": "info"
  },
  "dns": {
    "queryStrategy": "UseIP",
    "disableCache": false,
    "servers": [
      {
        "address": "119.29.29.29",
        "port": 53,
        "tag": "dns-direct",
        "domains": [
          "geosite:cn"
        ],
        "skipFallback": true
      },
      {
        "address": "8.8.8.8",
        "port": 53,
        "tag": "dns-proxy"
      }
    ]
  },
  "inbounds": [
    {
      "listen": "::",
      "tag": "tproxy-in",
      "port": 9898,
      "protocol": "dokodemo-door",
      "settings": {
        "allowedNetwork": "tcp,udp",
        "followRedirect": true
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "tproxy"
        }
      },
      "sniffing": {
        "enabled": true,
        "routeOnly": true,
        "destOverride": [
          "http",
          "tls",
          "quic"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "tag": "proxy",
      //填入vless配置
    },
    {
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "block"
    },
    {
      "protocol": "dns",
      "tag": "dns-out"
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "tproxy-in"
        ],
        "network": "tcp,udp",
        "port": 53,
        "outboundTag": "dns-out"
      },
      {
        "type": "field",
        "inboundTag": [
          "dns-direct"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "inboundTag": [
          "dns-proxy"
        ],
        "outboundTag": "proxy"
      },
      {
        "type": "field",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": [
          "geosite:cn",
        ],
        "outboundTag": "direct"
      }
    ],
    "balancer": []
  }
}