docs: add documentation comments for more exported constants and variables

- Add comments for ssl/client_verify.go verification modes
- Add comments for security/auth.go hash algorithms
- Add comments for rewrite/rewrite.go flags
- Add comments for compression/compression.go algorithms
- Add comments for limitrate/limitrate.go strategies
- Include author attribution (xfy)
This commit is contained in:
xfy911 2026-06-03 15:28:53 +08:00
parent 396a466de1
commit fc1de2d445
6 changed files with 19 additions and 17 deletions

View File

@ -29,7 +29,7 @@ import (
// 默认配置常量。
const (
// DefaultPprofPath pprof 端点的默认路径。
// DefaultPprofPath pprof 端点的默认路径。
DefaultPprofPath = "/debug/pprof"
)
@ -40,13 +40,13 @@ type ServerMode string
// ServerMode 枚举值。
const (
// ServerModeSingle 单服务器模式 - 只运行一个服务器实例。
// ServerModeSingle 单服务器模式 - 只运行一个服务器实例。
ServerModeSingle ServerMode = "single"
// ServerModeVHost 虚拟主机模式 - 多个服务器共享相同的监听地址。
// ServerModeVHost 虚拟主机模式 - 多个服务器共享相同的监听地址。
ServerModeVHost ServerMode = "vhost"
// ServerModeMultiServer 多服务器模式 - 多个服务器监听不同的地址。
// ServerModeMultiServer 多服务器模式 - 多个服务器监听不同的地址。
ServerModeMultiServer ServerMode = "multi_server"
// ServerModeAuto 自动模式 - 根据配置自动推断运行模式。
// ServerModeAuto 自动模式 - 根据配置自动推断运行模式。
ServerModeAuto ServerMode = "auto"
)

View File

@ -12,8 +12,10 @@ import (
const (
// LargeFileStrategySkip 跳过大文件限速
// LargeFileStrategySkip 大文件策略:跳过(不限制)。
LargeFileStrategySkip = "skip"
// LargeFileStrategyCoarse 粗粒度限速
// LargeFileStrategyCoarse 大文件策略:粗略限制。
LargeFileStrategyCoarse = "coarse"
)

View File

@ -36,16 +36,16 @@ const MaxRewriteIterations = 10
type Flag int
const (
// FlagLast 继续匹配其他规则nginx 行为:重新从第一条规则开始匹配)。
// FlagLast 继续匹配其他规则nginx 行为:重新从第一条规则开始匹配)。
// 匹配到规则后会重新从第一条规则开始遍历,用于多规则链式重写。
FlagLast Flag = iota
// FlagRedirect 返回 302 临时重定向。
// FlagRedirect 返回 302 临时重定向。
// 客户端收到 302 响应后重新请求新 URL不会继续匹配后续规则。
FlagRedirect
// FlagPermanent 返回 301 永久重定向。
// FlagPermanent 返回 301 永久重定向。
// 客户端收到 301 响应后永久重定向到新 URL不会继续匹配后续规则。
FlagPermanent
// FlagBreak 停止匹配规则。
// FlagBreak 停止匹配规则。
// 修改请求路径后终止重写流程,直接进入下一个处理器。
FlagBreak
)

View File

@ -43,9 +43,9 @@ import (
type Action int
const (
// ActionAllow 允许请求通过
// ActionAllow 允许请求通过
ActionAllow Action = iota
// ActionDeny 拒绝请求(返回 403 Forbidden
// ActionDeny 拒绝请求(返回 403 Forbidden
ActionDeny
accessAllow = "allow"

View File

@ -48,9 +48,9 @@ import (
type HashAlgorithm int
const (
// HashBcrypt bcrypt 算法(默认,推荐)
// HashBcrypt bcrypt 哈希算法(默认,推荐)
HashBcrypt HashAlgorithm = iota
// HashArgon2id Argon2id 算法(更安全,计算密集)
// HashArgon2id Argon2id 哈希算法(更安全,计算密集)
HashArgon2id
)

View File

@ -29,13 +29,13 @@ import (
type ClientVerifyMode int
const (
// VerifyOff 不验证客户端证书
// VerifyOff 不验证客户端证书
VerifyOff ClientVerifyMode = iota
// VerifyOn 强制验证客户端证书
// VerifyOn 强制验证客户端证书
VerifyOn
// VerifyOptional 可选验证(客户端可选择不提供证书)
// VerifyOptional 可选验证(客户端可选择不提供证书)
VerifyOptional
// VerifyOptionalNoCA 可选验证但不验证 CA
// VerifyOptionalNoCA 可选验证但不验证 CA
VerifyOptionalNoCA
// verifyModeOff 验证模式字符串常量