From a298ca725428a4b7380ace42a114d96a897cd59d Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 9 Apr 2026 13:25:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E5=AE=8C=E5=96=84=20GenerateCo?= =?UTF-8?q?nfigYAML=20HTTP/2=20=E5=92=8C=E8=AE=A4=E8=AF=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=A4=BA=E4=BE=8B=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- internal/config/defaults.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 1d8aa38..0206139 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -285,6 +285,13 @@ func GenerateConfigYAML(cfg *Config) ([]byte, error) { buf.WriteString(" # client_ca: \"\" # 客户端 CA 证书文件路径\n") buf.WriteString(" # verify_depth: 1 # 证书链验证深度\n") buf.WriteString(" # crl: \"\" # 证书撤销列表文件路径(可选)\n") + buf.WriteString(" # http2: # HTTP/2 配置(需 SSL 证书)\n") + fmt.Fprintf(&buf, " # enabled: %v # 是否启用 HTTP/2\n", cfg.Server.SSL.HTTP2.Enabled) + fmt.Fprintf(&buf, " # max_concurrent_streams: %d # 最大并发流数\n", cfg.Server.SSL.HTTP2.MaxConcurrentStreams) + fmt.Fprintf(&buf, " # max_header_list_size: %d # 最大头部列表大小(字节)\n", cfg.Server.SSL.HTTP2.MaxHeaderListSize) + fmt.Fprintf(&buf, " # idle_timeout: %ds # 空闲超时\n", int(cfg.Server.SSL.HTTP2.IdleTimeout.Seconds())) + fmt.Fprintf(&buf, " # push_enabled: %v # 是否启用 Server Push\n", cfg.Server.SSL.HTTP2.PushEnabled) + fmt.Fprintf(&buf, " # h2c_enabled: %v # 是否启用 H2C(明文 HTTP/2)\n", cfg.Server.SSL.HTTP2.H2CEnabled) buf.WriteString("\n") // security 配置 @@ -314,6 +321,7 @@ func GenerateConfigYAML(cfg *Config) ([]byte, error) { fmt.Fprintf(&buf, " algorithm: \"%s\" # 密码哈希算法(有效值: bcrypt, argon2id)\n", cfg.Server.Security.Auth.Algorithm) buf.WriteString(" users: [] # 用户列表\n") fmt.Fprintf(&buf, " realm: \"%s\" # 认证域\n", cfg.Server.Security.Auth.Realm) + fmt.Fprintf(&buf, " min_password_length: %d # 密码最小长度\n", cfg.Server.Security.Auth.MinPasswordLength) buf.WriteString("\n") buf.WriteString(" # 安全头部\n") buf.WriteString(" headers:\n")