跳到正文

sing-box 的出站、DNS 与 Hysteria 2 配置 ​

快问快答
配置结构:sing-box 的内核用 Go 编写。可在 Android、iOS、Linux、macOS 和 Windows 上分别查看对应的客户端及配置。路由和出站用 JSON 描述,可对照 Hysteria 2、TUIC、VLESS-Reality 或 ShadowTLS 的字段。

一、查看两类内核的配置文件 ​

配置格式 指标 1
sing-boxJSON(由对象或数组表示)
Clash (Mihomo)YAML(以缩进表示层级)
配置时的区别sing-box 使用 JSON 表达路由与协议字段
协议选择 指标 2
sing-box查看 sing-box 对应的出站类型
Clash (Mihomo)查看 Clash (Mihomo) 内核信息
配置时的区别Hysteria 2 和 VLESS 可分别核对出站字段
运行开销 指标 3
sing-box查看 sing-box 进程占用
Clash (Mihomo)查看 Mihomo 进程占用
配置时的区别可在同一设备和负载下对比 sing-box 与 Clash
各系统的配置 指标 4
sing-box以 JSON 描述内核设置
Clash (Mihomo)图形端的实现随平台而异
配置时的区别Mac/Win/iOS 之间迁移 config.json 时核对平台字段
界面操作 指标 5
sing-box按平台检查图形客户端
Clash (Mihomo)Clash Verge Rev 提供图形界面
配置时的区别Clash Verge 和 sing-box 的界面与配置格式各有区别

二、sing-box 的 JSON 配置组成 ​

可先按模块阅读 sing-box 的配置。

json
{
  "log": { "level": "info", "timestamp": true },
  "dns": { /* 独立 DNS 解析与防污染路由 */ },
  "inbounds": [ /* 本地流量接收入口 (TUN / SOCKS5 / Mixed) */ ],
  "outbounds": [ /* 节点集群与出口策略组 (Proxy / Direct / Block) */ ],
  "route": { /* 分流规则集与域名匹配 (Rule-set) */ }
}

TUN 入站配置示例 ​

json
{
  "type": "tun",
  "tag": "tun-in",
  "interface_name": "singbox-tun",
  "inet4_address": "172.19.0.1/30",
  "auto_route": true,
  "strict_route": true,
  "stack": "mixed",
  "sniff": true
}

三、Hysteria 2 出站参数 ​

使用 Hysteria 2 时,可在 outbounds 里核对带宽等字段。

json
{
  "type": "hysteria2",
  "tag": "hy2-node-01",

  "server_port": 443,
  "up_mbps": 100,
  "down_mbps": 500,
  "password": "your-secret-password",
  "tls": {
    "enabled": true,

    "insecure": false
  }
}

四、OpenClash 问答 ​


五、连接排查 ​

Loon 和 Quantumult X 的 iOS 设置
查看脚本与 MitM 重写如何配置。