浏览代码

Add brutal debug option for Hysteria2

世界 2 年之前
父节点
当前提交
343e24969d

+ 10 - 5
docs/configuration/inbound/hysteria2.md

@@ -20,8 +20,9 @@
     }
   ],
   "ignore_client_bandwidth": false,
+  "tls": {},
   "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`.
 
+#### tls
+
+==Required==
+
+TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
+
 #### masquerade
 
 HTTP3 server behavior when authentication fails.
@@ -78,8 +85,6 @@ HTTP3 server behavior when authentication fails.
 
 A 404 page will be returned if empty.
 
-#### tls
-
-==Required==
+#### brutal_debug
 
-TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
+Enable debug information logging for Hysteria Brutal CC.

+ 10 - 5
docs/configuration/inbound/hysteria2.zh.md

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

+ 5 - 0
docs/configuration/outbound/hysteria2.md

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

+ 4 - 0
docs/configuration/outbound/hysteria2.zh.md

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

+ 1 - 0
inbound/hysteria2.go

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

+ 8 - 6
option/hysteria2.go

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

+ 2 - 0
outbound/hysteria2.go

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