跳转至

Hysteria2

sing-box 1.14.0 中的更改

hop_interval_max
bbr_profile
realm

sing-box 1.11.0 中的更改

server_ports
hop_interval

结构

{
  "type": "hysteria2",
  "tag": "hy2-out",

  "server": "127.0.0.1",
  "server_port": 1080,
  "server_ports": [
    "2080:3000"
  ],
  "hop_interval": "",
  "hop_interval_max": "",
  "up_mbps": 100,
  "down_mbps": 100,
  "obfs": {
    "type": "salamander",
    "password": "cry_me_a_r1ver"
  },
  "password": "goofy_ahh_password",
  "network": "tcp",
  "tls": {},

  ... // QUIC 字段

  "bbr_profile": "",
  "brutal_debug": false,
  "realm": {
    "server_url": "https://realm.example.com",
    "token": "",
    "realm_id": "",
    "stun_servers": [],
    "http_client": {}
  },

  ... // 拨号字段
}

当内容只有一项时,可以忽略 JSON 数组 [] 标签

与官方 Hysteria2 的区别

官方程序支持一种名为 userpass 的验证方式, 本质上是将用户名与密码的组合 <username>:<password> 作为实际上的密码,而 sing-box 不提供此别名。 要将 sing-box 与官方程序一起使用, 您需要填写该组合作为实际密码。

字段

server

必填

服务器地址。

realm 冲突。

server_port

必填

服务器端口。

如果设置了 server_ports,则忽略此项。

realm 冲突。

server_ports

自 sing-box 1.11.0 起

服务器端口范围列表。

server_portrealm 冲突。

hop_interval

自 sing-box 1.11.0 起

端口跳跃间隔。

默认使用 30s

hop_interval_max

自 sing-box 1.14.0 起

最大端口跳跃间隔,用于随机化。

如果设置,实际跳跃间隔将在 hop_intervalhop_interval_max 之间随机选择。

up_mbps, down_mbps

最大带宽。

如果为空,将使用 BBR 拥塞控制算法而不是 Hysteria CC。

obfs.type

QUIC 流量混淆器类型,仅可设为 salamander

如果为空则禁用。

obfs.password

QUIC 流量混淆器密码.

password

认证密码。

network

启用的网络协议。

tcpudp

默认所有。

tls

必填

TLS 配置, 参阅 TLS

QUIC 字段

参阅 QUIC 字段 了解详情。

bbr_profile

自 sing-box 1.14.0 起

BBR 拥塞控制算法配置,可选 conservative standard aggressive

默认使用 standard

brutal_debug

启用 Hysteria Brutal CC 的调试信息日志记录。

realm

自 sing-box 1.14.0 起

通过 Hysteria Realm 会合服务连接 Hysteria2 服务器。

出站从 realm 查询服务器当前的公网地址,执行 UDP 打洞,然后进行常规的 QUIC 握手。

serverserver_portserver_ports 冲突。

TLS SNI 默认使用 server_url 中的主机名。需设置 tls.server_name 以匹配 Hysteria2 服务器证书覆盖的名字。

会合服务参阅 Hysteria Realm

realm.server_url

必填

Realm 会合服务 URL。

realm.token

Realm 的 Bearer 令牌,需与 realm 上配置的 users[].token 之一匹配。

realm.realm_id

必填

目标 Hysteria2 服务器注册时使用的相同槽位标识符。

realm.stun_servers

必填

用于发现本客户端公网地址的 STUN 服务器列表(hosthost:port)。

域名通过 拨号字段 中的 domain_resolver 解析。

realm.http_client

与 realm 通信使用的 HTTP 客户端。

参阅 HTTP 客户端 了解详情。

拨号字段

参阅 拨号字段