Files
sing-box-extended-mirror/docs/configuration/inbound/hysteria2.md
T

245 lines
5.4 KiB
Markdown
Raw Normal View History

2024-11-28 22:39:19 +08:00
---
icon: material/alert-decagram
---
!!! quote "Changes in sing-box 1.14.0"
2026-05-10 13:31:53 +08:00
:material-plus: [bbr_profile](#bbr_profile)
2026-05-25 13:11:59 +08:00
:material-plus: [realm](#realm)
:material-alert: [obfs](#obfstype)
2024-11-28 22:39:19 +08:00
!!! quote "Changes in sing-box 1.11.0"
2024-12-29 08:52:12 +08:00
:material-alert: [masquerade](#masquerade)
:material-alert: [ignore_client_bandwidth](#ignore_client_bandwidth)
2024-11-28 22:39:19 +08:00
2023-09-09 13:42:38 +08:00
### Structure
```json
{
"type": "hysteria2",
"tag": "hy2-in",
2024-11-28 22:39:19 +08:00
... // Listen Fields
2023-09-09 13:42:38 +08:00
"up_mbps": 100,
"down_mbps": 100,
"obfs": {
"type": "salamander",
"password": "cry_me_a_r1ver"
},
"users": [
{
"name": "tobyxdd",
"password": "goofy_ahh_password"
}
],
"ignore_client_bandwidth": false,
2023-10-21 12:00:00 +08:00
"tls": {},
... // QUIC Fields
2024-11-28 22:39:19 +08:00
"masquerade": "", // or {}
"bbr_profile": "",
2026-05-10 13:31:53 +08:00
"brutal_debug": false,
"realm": {
"server_url": "https://realm.example.com",
"token": "",
"realm_id": "",
"stun_servers": [],
2026-05-11 16:24:34 +08:00
"stun_domain_resolver": "", // or {}
2026-05-10 13:31:53 +08:00
"http_client": {}
}
2023-09-09 13:42:38 +08:00
}
```
2023-11-09 17:04:08 +08:00
!!! warning "Difference from official Hysteria2"
The official program supports an authentication method called **userpass**,
which essentially uses a combination of `<username>:<password>` as the actual password,
while sing-box does not provide this alias.
To use sing-box with the official program, you need to fill in that combination as the actual password.
2023-09-09 13:42:38 +08:00
### Listen Fields
2023-12-14 22:23:52 +08:00
See [Listen Fields](/configuration/shared/listen/) for details.
2023-09-09 13:42:38 +08:00
### Fields
#### up_mbps, down_mbps
Max bandwidth, in Mbps.
Not limited if empty.
Conflict with `ignore_client_bandwidth`.
#### obfs.type
2026-05-25 13:11:59 +08:00
QUIC traffic obfuscator type, one of `salamander` `gecko`.
2023-09-09 13:42:38 +08:00
Disabled if empty.
#### obfs.password
QUIC traffic obfuscator password.
2026-05-25 13:11:59 +08:00
#### obfs.min_packet_size
!!! question "Since sing-box 1.14.0"
Minimum on-wire packet size in bytes. Gecko only.
`512` is used by default.
#### obfs.max_packet_size
!!! question "Since sing-box 1.14.0"
Maximum on-wire packet size in bytes. Gecko only.
`1200` is used by default.
2023-09-09 13:42:38 +08:00
#### users
Hysteria2 users
#### users.password
Authentication password
#### ignore_client_bandwidth
2024-12-29 08:52:12 +08:00
*When `up_mbps` and `down_mbps` are not set*:
2023-09-09 13:42:38 +08:00
2024-12-29 08:52:12 +08:00
Commands clients to use the BBR CC instead of Hysteria CC.
*When `up_mbps` and `down_mbps` are set*:
Deny clients to use the BBR CC.
2023-09-09 13:42:38 +08:00
2023-10-21 12:00:00 +08:00
#### tls
==Required==
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
### QUIC Fields
See [QUIC Fields](/configuration/shared/quic/) for details.
2023-09-09 13:42:38 +08:00
#### masquerade
2024-11-28 22:39:19 +08:00
HTTP3 server behavior (URL string configuration) when authentication fails.
2023-09-09 13:42:38 +08:00
| Scheme | Example | Description |
|--------------|-------------------------|--------------------|
| `file` | `file:///var/www` | As a file server |
| `http/https` | `http://127.0.0.1:8080` | As a reverse proxy |
2024-11-28 22:39:19 +08:00
Conflict with `masquerade.type`.
A 404 page will be returned if masquerade is not configured.
#### masquerade.type
HTTP3 server behavior (Object configuration) when authentication fails.
| Type | Description | Fields |
|----------|-----------------------------|-------------------------------------|
| `file` | As a file server | `directory` |
| `proxy` | As a reverse proxy | `url`, `rewrite_host` |
| `string` | Reply with a fixed response | `status_code`, `headers`, `content` |
Conflict with `masquerade`.
A 404 page will be returned if masquerade is not configured.
#### masquerade.directory
File server root directory.
#### masquerade.url
Reverse proxy target URL.
#### masquerade.rewrite_host
Rewrite the `Host` header to the target URL.
#### masquerade.status_code
Fixed response status code.
#### masquerade.headers
Fixed response headers.
#### masquerade.content
Fixed response content.
2023-09-09 13:42:38 +08:00
#### bbr_profile
!!! question "Since sing-box 1.14.0"
BBR congestion control algorithm profile, one of `conservative` `standard` `aggressive`.
`standard` is used by default.
2023-10-21 12:00:00 +08:00
#### brutal_debug
2023-09-09 13:42:38 +08:00
2023-10-21 12:00:00 +08:00
Enable debug information logging for Hysteria Brutal CC.
2026-05-10 13:31:53 +08:00
#### realm
!!! question "Since sing-box 1.14.0"
Register this inbound to a Hysteria Realm rendezvous service to enable NAT traversal.
The inbound discovers its public addresses via STUN, registers them on the realm, and uses UDP hole-punching to accept incoming clients without a publicly reachable listen address.
See [Hysteria Realm](/configuration/service/hysteria-realm/) for the rendezvous service.
#### realm.server_url
==Required==
Realm rendezvous service URL.
#### realm.token
Bearer token for the realm. Must match one of `users[].token` configured on the realm.
#### realm.realm_id
==Required==
Slot identifier on the realm.
1–64 characters, must match `^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$`.
Outbounds must use the same `realm_id` to find this server.
#### realm.stun_servers
==Required==
List of STUN servers (`host` or `host:port`) used to discover public addresses.
2026-05-11 16:24:34 +08:00
#### realm.stun_domain_resolver
Set domain resolver to use for resolving STUN server domain names.
This option uses the same format as the [route DNS rule action](/configuration/dns/rule_action/#route) without the `action` field.
Setting this option directly to a string is equivalent to setting `server` of this options.
If empty, the default domain resolver is used.
2026-05-10 13:31:53 +08:00
#### realm.http_client
HTTP client used to talk to the realm.
See [HTTP Client](/configuration/shared/http-client/) for details.