5.1 KiB
!!! quote "sing-box 1.14.0 中的更改"
:material-plus: [hop_interval_max](#hop_interval_max)
:material-plus: [bbr_profile](#bbr_profile)
:material-plus: [realm](#realm)
:material-alert: [obfs](#obfstype)
!!! quote "sing-box 1.11.0 中的更改"
:material-plus: [server_ports](#server_ports)
:material-plus: [hop_interval](#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": [],
"ip_version": 0,
"port_mapping": {
"enabled": false,
"timeout": "",
"lifetime": ""
},
"http_client": {}
},
... // 拨号字段
}
!!! note ""
当内容只有一项时,可以忽略 JSON 数组 [] 标签
!!! warning "与官方 Hysteria2 的区别"
官方程序支持一种名为 **userpass** 的验证方式,
本质上是将用户名与密码的组合 `<username>:<password>` 作为实际上的密码,而 sing-box 不提供此别名。
要将 sing-box 与官方程序一起使用, 您需要填写该组合作为实际密码。
字段
server
==必填==
服务器地址。
与 realm 冲突。
server_port
==必填==
服务器端口。
如果设置了 server_ports,则忽略此项。
与 realm 冲突。
server_ports
!!! question "自 sing-box 1.11.0 起"
服务器端口范围列表。
与 server_port 和 realm 冲突。
hop_interval
!!! question "自 sing-box 1.11.0 起"
端口跳跃间隔。
默认使用 30s。
hop_interval_max
!!! question "自 sing-box 1.14.0 起"
最大端口跳跃间隔,用于随机化。
如果设置,实际跳跃间隔将在 hop_interval 和 hop_interval_max 之间随机选择。
up_mbps, down_mbps
最大带宽。
如果为空,将使用 BBR 拥塞控制算法而不是 Hysteria CC。
obfs.type
QUIC 流量混淆器类型,可选 salamander gecko。
如果为空则禁用。
obfs.password
QUIC 流量混淆器密码。
obfs.min_packet_size
!!! question "自 sing-box 1.14.0 起"
最小线上数据包大小(字节)。仅限 Gecko。
默认使用 512。
obfs.max_packet_size
!!! question "自 sing-box 1.14.0 起"
最大线上数据包大小(字节)。仅限 Gecko。
默认使用 1200。
password
认证密码。
network
启用的网络协议。
tcp 或 udp。
默认所有。
tls
==必填==
TLS 配置, 参阅 TLS。
QUIC 字段
参阅 QUIC 字段 了解详情。
bbr_profile
!!! question "自 sing-box 1.14.0 起"
BBR 拥塞控制算法配置,可选 conservative standard aggressive。
默认使用 standard。
brutal_debug
启用 Hysteria Brutal CC 的调试信息日志记录。
realm
!!! question "自 sing-box 1.14.0 起"
通过 Hysteria Realm 会合服务连接 Hysteria2 服务器。
出站从 realm 查询服务器当前的公网地址,执行 UDP 打洞,然后进行常规的 QUIC 握手。
与 server、server_port 和 server_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 服务器列表(host 或 host:port)。
域名通过 拨号字段 中的 domain_resolver 解析。
realm.ip_version
将 realm 连接(STUN、打洞与最终的 QUIC 路径)限制为单一 IP 版本。
4 或 6。默认使用两者。
realm.port_mapping
通过 UPnP 或 NAT-PMP 在本地网关上维护 UDP 端口映射。
映射在 STUN 发现之前建立,可在支持的网关后提升打洞成功率;失败不影响正常流程。
需要 IPv4:与 "ip_version": 6 冲突。
realm.port_mapping.enabled
启用端口映射。
realm.port_mapping.timeout
网关发现与映射操作的超时。
默认使用 10s。
realm.port_mapping.lifetime
映射的租约时长;每过一半时长续期一次。
默认使用 10m。
realm.http_client
与 realm 通信使用的 HTTP 客户端。
参阅 HTTP 客户端 了解详情。
拨号字段
参阅 拨号字段。