Add brutal debug option for Hysteria2

This commit is contained in:
世界 2023-10-21 12:00:00 +08:00
parent 31c294d998
commit 343e24969d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
7 changed files with 40 additions and 16 deletions

View file

@ -20,8 +20,9 @@
} }
], ],
"ignore_client_bandwidth": false, "ignore_client_bandwidth": false,
"tls": {},
"masquerade": "", "masquerade": "",
"tls": {} "brutal_debug": false
} }
``` ```
@ -67,6 +68,12 @@ Commands the client to use the BBR flow control algorithm instead of Hysteria CC
Conflict with `up_mbps` and `down_mbps`. Conflict with `up_mbps` and `down_mbps`.
#### tls
==Required==
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
#### masquerade #### masquerade
HTTP3 server behavior when authentication fails. HTTP3 server behavior when authentication fails.
@ -78,8 +85,6 @@ HTTP3 server behavior when authentication fails.
A 404 page will be returned if empty. A 404 page will be returned if empty.
#### tls #### brutal_debug
==Required== Enable debug information logging for Hysteria Brutal CC.
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).

View file

@ -20,8 +20,9 @@
} }
], ],
"ignore_client_bandwidth": false, "ignore_client_bandwidth": false,
"tls": {},
"masquerade": "", "masquerade": "",
"tls": {} "brutal_debug": false
} }
``` ```
@ -65,6 +66,12 @@ Hysteria 用户
`up_mbps``down_mbps` 冲突。 `up_mbps``down_mbps` 冲突。
#### tls
==必填==
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
#### masquerade #### masquerade
HTTP3 服务器认证失败时的行为。 HTTP3 服务器认证失败时的行为。
@ -76,8 +83,6 @@ HTTP3 服务器认证失败时的行为。
如果为空,则返回 404 页。 如果为空,则返回 404 页。
#### tls #### brutal_debug
==必填== 启用 Hysteria Brutal CC 的调试信息日志记录。
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。

View file

@ -16,6 +16,7 @@
"password": "goofy_ahh_password", "password": "goofy_ahh_password",
"network": "tcp", "network": "tcp",
"tls": {}, "tls": {},
"brutal_debug": false,
... // Dial Fields ... // Dial Fields
} }
@ -73,6 +74,10 @@ Both is enabled by default.
TLS configuration, see [TLS](/configuration/shared/tls/#outbound). TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
#### brutal_debug
Enable debug information logging for Hysteria Brutal CC.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. See [Dial Fields](/configuration/shared/dial) for details.

View file

@ -16,6 +16,7 @@
"password": "goofy_ahh_password", "password": "goofy_ahh_password",
"network": "tcp", "network": "tcp",
"tls": {}, "tls": {},
"brutal_debug": false,
... // 拨号字段 ... // 拨号字段
} }
@ -73,6 +74,9 @@ QUIC 流量混淆器密码.
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。 TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
#### brutal_debug
启用 Hysteria Brutal CC 的调试信息日志记录。
### 拨号字段 ### 拨号字段

View file

@ -90,6 +90,7 @@ func NewHysteria2(ctx context.Context, router adapter.Router, logger log.Context
service, err := hysteria2.NewService[int](hysteria2.ServiceOptions{ service, err := hysteria2.NewService[int](hysteria2.ServiceOptions{
Context: ctx, Context: ctx,
Logger: logger, Logger: logger,
BrutalDebug: options.BrutalDebug,
SendBPS: uint64(options.UpMbps * hysteria.MbpsToBps), SendBPS: uint64(options.UpMbps * hysteria.MbpsToBps),
ReceiveBPS: uint64(options.DownMbps * hysteria.MbpsToBps), ReceiveBPS: uint64(options.DownMbps * hysteria.MbpsToBps),
SalamanderPassword: salamanderPassword, SalamanderPassword: salamanderPassword,

View file

@ -9,6 +9,7 @@ type Hysteria2InboundOptions struct {
IgnoreClientBandwidth bool `json:"ignore_client_bandwidth,omitempty"` IgnoreClientBandwidth bool `json:"ignore_client_bandwidth,omitempty"`
TLS *InboundTLSOptions `json:"tls,omitempty"` TLS *InboundTLSOptions `json:"tls,omitempty"`
Masquerade string `json:"masquerade,omitempty"` Masquerade string `json:"masquerade,omitempty"`
BrutalDebug bool `json:"brutal_debug,omitempty"`
} }
type Hysteria2Obfs struct { type Hysteria2Obfs struct {
@ -24,10 +25,11 @@ type Hysteria2User struct {
type Hysteria2OutboundOptions struct { type Hysteria2OutboundOptions struct {
DialerOptions DialerOptions
ServerOptions ServerOptions
UpMbps int `json:"up_mbps,omitempty"` UpMbps int `json:"up_mbps,omitempty"`
DownMbps int `json:"down_mbps,omitempty"` DownMbps int `json:"down_mbps,omitempty"`
Obfs *Hysteria2Obfs `json:"obfs,omitempty"` Obfs *Hysteria2Obfs `json:"obfs,omitempty"`
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
Network NetworkList `json:"network,omitempty"` Network NetworkList `json:"network,omitempty"`
TLS *OutboundTLSOptions `json:"tls,omitempty"` TLS *OutboundTLSOptions `json:"tls,omitempty"`
BrutalDebug bool `json:"brutal_debug,omitempty"`
} }

View file

@ -61,6 +61,8 @@ func NewHysteria2(ctx context.Context, router adapter.Router, logger log.Context
client, err := hysteria2.NewClient(hysteria2.ClientOptions{ client, err := hysteria2.NewClient(hysteria2.ClientOptions{
Context: ctx, Context: ctx,
Dialer: outboundDialer, Dialer: outboundDialer,
Logger: logger,
BrutalDebug: options.BrutalDebug,
ServerAddress: options.ServerOptions.Build(), ServerAddress: options.ServerOptions.Build(),
SendBPS: uint64(options.UpMbps * hysteria.MbpsToBps), SendBPS: uint64(options.UpMbps * hysteria.MbpsToBps),
ReceiveBPS: uint64(options.DownMbps * hysteria.MbpsToBps), ReceiveBPS: uint64(options.DownMbps * hysteria.MbpsToBps),