使用 sing-box 代替 clash

之前推荐了使用 Clash 来作为家里的透明网关,但是由于 Clash 历史遗留问题较多, 而 sing-box 由于是新项目,所以其代码比较纯粹,也更加有想象空间,所以我决定尝试使用 sing-box 代替 clash。 sing-box 的安装很简单,照着官网的教程就可以了,由于我只使用 sing-box 的代理功能,暂时不需要分流,所以我的配置也比较简单:

{
  "log": {
    "disabled": false,
    "level": "info",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "local-dns",
        "address": "192.168.1.1",
        "detour": "direct"
      }
    ],
    "rules": [
      {
        "outbound": "any",
        "server": "local-dns"
      }
    ]
  },
  "inbounds": [
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "::",
      "listen_port": 8888,
      "sniff": true
    },
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "utun",
      "inet4_address": "172.19.0.1/30",
      "auto_route": true,
      "stack": "system",
      "mtu": 9000,
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "selector",
      "tag": "Proxy",
      "outbounds": [
        "Japan 11"
      ],
      "interrupt_exist_connections": true
    },
    {
      "type": "shadowsocks",
      "tag": "Japan 11",
      "server": "xxxx",
      "server_port": 90, 
      "password": "xxxx",
      "method": "aes-128-gcm",
      "udp_over_tcp": true
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "rules": [
      {
        "ip_is_private": true,
        "outbound": "direct"
      }
    ],
    "auto_detect_interface": true,
    "final": "Proxy"
  },
  "experimental": {
    "cache_file": {
      "enabled": true,
      "path": "cache.db",
      "cache_id": "my_profile2",
      "store_fakeip": true
    },
    "clash_api": {
      "external_ui": "ui",
      "external_controller": "0.0.0.0:9090",
      "external_ui_download_detour": "Proxy",
      "default_mode": "direct"
    }
  }
}

这样就可以完全替代之前的 Clash 了。