Skip to content

迁移指南

1.11.0

迁移旧的特殊出站到规则动作

旧的特殊出站已被弃用,且可以被规则动作替代。

json
{
  "outbounds": [
    {
      "type": "block",
      "tag": "block"
    }
  ],
  "route": {
    "rules": [
      {
        ...,

        "outbound": "block"
      }
    ]
  }
}

迁移旧的入站字段到规则动作

入站选项已被弃用,且可以被规则动作替代。

json
{
  "inbounds": [
    {
      "type": "mixed",
      "sniff": true,
      "sniff_timeout": "1s",
      "domain_strategy": "prefer_ipv4"
    }
  ]
}

迁移 direct 出站中的目标地址覆盖字段到路由字段

direct 出站中的目标地址覆盖字段已废弃,且可以被路由字段替代。

json
{
  "outbounds": [
    {
      "type": "direct",
      "override_address": "1.1.1.1",
      "override_port": 443
    }
  ]
}

迁移 WireGuard 出站到端点

WireGuard 出站已被弃用,且可以被端点替代。

json
{
  "outbounds": [
    {
      "type": "wireguard",
      "tag": "wg-out",

      "server": "127.0.0.1",
      "server_port": 10001,
      "system_interface": true,
      "gso": true,
      "interface_name": "wg0",
      "local_address": ["10.0.0.1/32"],
      "private_key": "<private_key>",
      "peer_public_key": "<peer_public_key>",
      "pre_shared_key": "<pre_shared_key>",
      "reserved": [0, 0, 0],
      "mtu": 1408
    }
  ]
}

1.10.0

TUN 地址字段已合并

inet4_addressinet6_address 已合并为 address

inet4_route_addressinet6_route_address 已合并为 route_address

inet4_route_exclude_addressinet6_route_exclude_address 已合并为 route_exclude_address

参考

TUN

json
{
  "inbounds": [
    {
      "type": "tun",
      "inet4_address": "172.19.0.1/30",
      "inet6_address": "fdfe:dcba:9876::1/126",
      "inet4_route_address": ["0.0.0.0/1", "128.0.0.0/1"],
      "inet6_route_address": ["::/1", "8000::/1"],
      "inet4_route_exclude_address": ["192.168.0.0/16"],
      "inet6_route_exclude_address": ["fc00::/7"]
    }
  ]
}

1.9.5

Apple 平台客户端的 Bundle Identifier 更新

由于我们旧的苹果开发者账户存在问题,我们只能通过更新 Bundle Identifiers 来重新上架 sing-box 应用,这意味着数据不会自动继承。

对于 iOS,您需要自行备份旧的数据(如果您仍然可以访问); 对于 Apple tvOS,您需要从 iPhone 或 iPad 重新导入配置或者手动创建; 对于 macOS,您可以使用以下命令迁移数据文件夹:

bash
cd ~/Library/Group\ Containers && \
  mv group.io.nekohasekai.sfa group.io.nekohasekai.sfavt

1.9.0

domain_suffix 行为更新

由于历史原因,sing-box 的 domain_suffix 规则匹配字面前缀,而不与其他项目相同。

sing-box 1.9.0 修改了 domain_suffix 的行为:如果规则值以 . 为前缀则行为不变,否则改为匹配 (domain|.+\.domain)

对 Windows 上 process_path 格式的更新

sing-box 的 process_path 规则继承自 Clash, 原始代码使用本地系统的路径格式(例如 \Device\HarddiskVolume1\folder\program.exe), 但是当设备有多个硬盘时,该 HarddiskVolume 系列号并不稳定。

sing-box 1.9.0 使 QueryFullProcessImageNameW 输出 Win32 路径(如 C:\folder\program.exe), 这将会破坏现有的 Windows process_path 用例。

1.8.0

将缓存文件从 Clash API 迁移到独立选项

json
{
  "experimental": {
    "clash_api": {
      "cache_file": "cache.db", // default value
      "cahce_id": "my_profile2",
      "store_mode": true,
      "store_selected": true,
      "store_fakeip": true
    }
  }
}

迁移 GeoIP 到规则集

> `sing-box geoip` 命令可以帮助您将自定义 GeoIP 转换为规则集。

json
{
  "route": {
    "rules": [
      {
        "geoip": "private",
        "outbound": "direct"
      },
      {
        "geoip": "cn",
        "outbound": "direct"
      },
      {
        "source_geoip": "cn",
        "outbound": "block"
      }
    ],
    "geoip": {
      "download_detour": "proxy"
    }
  }
}

迁移 Geosite 到规则集

> `sing-box geosite` 命令可以帮助您将自定义 Geosite 转换为规则集。

json
{
  "route": {
    "rules": [
      {
        "geosite": "cn",
        "outbound": "direct"
      }
    ],
    "geosite": {
      "download_detour": "proxy"
    }
  }
}