docs: add documentation comments for exported constants and variables
- Add comments for lua/api_log.go HTTP status codes and log levels - Add comments for variable/builtin.go and ssl.go constants - Add comments for utils/httperror.go error variables - Add comments for matcher/matcher.go location types - Add comments for compression/compression.go algorithms - Include author attribution (xfy)
This commit is contained in:
parent
0b5b0eb747
commit
396a466de1
315
doc-report.md
Normal file
315
doc-report.md
Normal file
@ -0,0 +1,315 @@
|
||||
# Lolly 项目缺少文档注释的导出标识符检测报告
|
||||
|
||||
## 概述
|
||||
|
||||
使用 AST 静态分析扫描 `/root/projects/lolly`,共发现 **180** 个导出的函数/类型/常量/变量缺少以标识符名称开头的文档注释(GoDoc)。
|
||||
|
||||
---
|
||||
|
||||
## 一、公共 API(非 internal 包)
|
||||
|
||||
| 文件 | 行号 | 类型 | 名称 |
|
||||
|------|------|------|------|
|
||||
| `gjson/gjson.go` | 35 | const | `ModuleName` |
|
||||
| `gjson/gjson.go` | 38 | const | `Version` |
|
||||
|
||||
**说明**:`gjson` 是项目中唯一的非 internal 子包,其导出的 `ModuleName` 和 `Version` 常量缺少文档注释。
|
||||
|
||||
---
|
||||
|
||||
## 二、internal 包中的缺失(按文件分组)
|
||||
|
||||
### internal/benchmark/tools/tools.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 13 | const | `Size100B` |
|
||||
| 14 | const | `Size1KB` |
|
||||
| 15 | const | `Size10KB` |
|
||||
| 16 | const | `Size100KB` |
|
||||
| 17 | const | `Size1MB` |
|
||||
| 36 | const | `ModeNormalResponse` |
|
||||
| 37 | const | `ModeRandomResponse` |
|
||||
| 38 | const | `ModeErrorResponse` |
|
||||
| 39 | const | `ModeDelayedResponse` |
|
||||
|
||||
### internal/config/config.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 33 | const | `DefaultPprofPath` |
|
||||
| 44 | const | `ServerModeSingle` |
|
||||
| 46 | const | `ServerModeVHost` |
|
||||
| 48 | const | `ServerModeMultiServer` |
|
||||
| 50 | const | `ServerModeAuto` |
|
||||
|
||||
### internal/converter/nginx/converter.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 28 | method | `Warning.String` |
|
||||
|
||||
### internal/converter/nginx/parser.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 31 | method | `*ParseError.Error` |
|
||||
|
||||
### internal/e2e/testutil/constants.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 18 | const | `ContainerStartupTimeout` |
|
||||
| 21 | const | `HealthCheckWaitTimeout` |
|
||||
| 24 | const | `HealthCheckDetectionTime` |
|
||||
| 27 | const | `CacheExpireBuffer` |
|
||||
| 30 | const | `DefaultTestTimeout` |
|
||||
| 33 | const | `DefaultClientTimeout` |
|
||||
| 36 | const | `ConcurrentRequestTimeout` |
|
||||
| 39 | const | `ShortTestTimeout` |
|
||||
| 42 | const | `MediumTestTimeout` |
|
||||
| 48 | const | `DefaultBackendCount` |
|
||||
| 51 | const | `DefaultConcurrentRequests` |
|
||||
| 54 | const | `HighConcurrentRequests` |
|
||||
| 57 | const | `CacheTestMaxAge` |
|
||||
| 60 | const | `CacheTestShortMaxAge` |
|
||||
| 66 | const | `TLSVersion12` |
|
||||
| 69 | const | `TLSVersion13` |
|
||||
|
||||
### internal/e2e/testutil/websocket.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 41 | func | `WithWSHeaders` |
|
||||
|
||||
### internal/lua/api_log.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 29 | const | `LogStderr` |
|
||||
| 30 | const | `LogEmerg` |
|
||||
| 31 | const | `LogAlert` |
|
||||
| 32 | const | `LogCrit` |
|
||||
| 33 | const | `LogErr` |
|
||||
| 34 | const | `LogWarn` |
|
||||
| 35 | const | `LogNotice` |
|
||||
| 36 | const | `LogInfo` |
|
||||
| 37 | const | `LogDebug` |
|
||||
| 42 | const | `HTTPContinue` |
|
||||
| 43 | const | `HTTPSwitchingProtocols` |
|
||||
| 44 | const | `HTTPOK` |
|
||||
| 45 | const | `HTTPCreated` |
|
||||
| 46 | const | `HTTPAccepted` |
|
||||
| 47 | const | `HTTPNoContent` |
|
||||
| 48 | const | `HTTPPartialContent` |
|
||||
| 49 | const | `HTTPMovedPermanently` |
|
||||
| 50 | const | `HTTPFound` |
|
||||
| 51 | const | `HTTPSeeOther` |
|
||||
| 52 | const | `HTTPNotModified` |
|
||||
| 53 | const | `HTTPTemporaryRedirect` |
|
||||
| 54 | const | `HTTPPermanentRedirect` |
|
||||
| 55 | const | `HTTPBadRequest` |
|
||||
| 56 | const | `HTTPUnauthorized` |
|
||||
| 57 | const | `HTTPForbidden` |
|
||||
| 58 | const | `HTTPNotFound` |
|
||||
| 59 | const | `HTTPMethodNotAllowed` |
|
||||
| 60 | const | `HTTPRequestTimeout` |
|
||||
| 61 | const | `HTTPConflict` |
|
||||
| 62 | const | `HTTPGone` |
|
||||
| 63 | const | `HTTPLengthRequired` |
|
||||
| 64 | const | `HTTPPayloadTooLarge` |
|
||||
| 65 | const | `HTTPURITooLong` |
|
||||
| 66 | const | `HTTPUnsupportedMedia` |
|
||||
| 67 | const | `HTTPRangeNotSatisfiable` |
|
||||
| 68 | const | `HTTPTooManyRequests` |
|
||||
| 69 | const | `HTTPInternalServerError` |
|
||||
| 70 | const | `HTTPNotImplemented` |
|
||||
| 71 | const | `HTTPBadGateway` |
|
||||
| 72 | const | `HTTPServiceUnavailable` |
|
||||
| 73 | const | `HTTPGatewayTimeout` |
|
||||
| 74 | const | `HTTPHTTPVersionNotSupported` |
|
||||
|
||||
### internal/lua/api_req.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 36 | const | `APILayerDirect` |
|
||||
| 40 | const | `APILayerCompatible` |
|
||||
| 44 | const | `APILayerPseudoNonBlocking` |
|
||||
| 58 | method | `ngxReqAPILayer.String` |
|
||||
|
||||
### internal/lua/cache.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 38 | const | `CacheKeyInline` |
|
||||
| 41 | const | `CacheKeyFile` |
|
||||
|
||||
### internal/lua/coroutine.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 35 | const | `PhaseInit` |
|
||||
| 37 | const | `PhaseRewrite` |
|
||||
| 39 | const | `PhaseAccess` |
|
||||
| 41 | const | `PhaseContent` |
|
||||
| 43 | const | `PhaseLog` |
|
||||
| 45 | const | `PhaseHeaderFilter` |
|
||||
| 47 | const | `PhaseBodyFilter` |
|
||||
| 50 | method | `Phase.String` |
|
||||
|
||||
### internal/lua/socket_manager.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 36 | const | `SocketStateIdle` |
|
||||
| 38 | const | `SocketStateConnecting` |
|
||||
| 40 | const | `SocketStateConnected` |
|
||||
| 42 | const | `SocketStateSending` |
|
||||
| 44 | const | `SocketStateReceiving` |
|
||||
| 46 | const | `SocketStateClosing` |
|
||||
| 48 | const | `SocketStateClosed` |
|
||||
| 50 | const | `SocketStateError` |
|
||||
| 83 | const | `OpConnect` |
|
||||
| 85 | const | `OpSend` |
|
||||
| 87 | const | `OpReceive` |
|
||||
| 89 | const | `OpClose` |
|
||||
|
||||
### internal/matcher/location.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 257 | method | `*ConflictError.Error` |
|
||||
|
||||
### internal/matcher/matcher.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 27 | const | `LocationTypeExact` |
|
||||
| 28 | const | `LocationTypePrefix` |
|
||||
| 29 | const | `LocationTypePrefixPriority` |
|
||||
| 30 | const | `LocationTypeRegex` |
|
||||
| 31 | const | `LocationTypeRegexCaseless` |
|
||||
| 32 | const | `LocationTypeNamed` |
|
||||
|
||||
### internal/middleware/compression/compression.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 100 | const | `AlgorithmGzip` |
|
||||
| 102 | const | `AlgorithmBrotli` |
|
||||
|
||||
### internal/middleware/limitrate/limitrate.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 15 | const | `LargeFileStrategySkip` |
|
||||
| 17 | const | `LargeFileStrategyCoarse` |
|
||||
|
||||
### internal/middleware/rewrite/rewrite.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 41 | const | `FlagLast` |
|
||||
| 44 | const | `FlagRedirect` |
|
||||
| 47 | const | `FlagPermanent` |
|
||||
| 50 | const | `FlagBreak` |
|
||||
|
||||
### internal/middleware/security/access.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 47 | const | `ActionAllow` |
|
||||
| 49 | const | `ActionDeny` |
|
||||
|
||||
### internal/middleware/security/auth.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 52 | const | `HashBcrypt` |
|
||||
| 54 | const | `HashArgon2id` |
|
||||
|
||||
### internal/resolver/resolver.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 446 | method | `*noopResolver.LookupHost` |
|
||||
| 450 | method | `*noopResolver.LookupHostWithCache` |
|
||||
| 454 | method | `*noopResolver.Refresh` |
|
||||
| 458 | method | `*noopResolver.Start` |
|
||||
| 462 | method | `*noopResolver.Stop` |
|
||||
| 466 | method | `*noopResolver.Stats` |
|
||||
|
||||
### internal/ssl/client_verify.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 33 | const | `VerifyOff` |
|
||||
| 35 | const | `VerifyOn` |
|
||||
| 37 | const | `VerifyOptional` |
|
||||
| 39 | const | `VerifyOptionalNoCA` |
|
||||
|
||||
### internal/stream/stream.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 82 | method | `*roundRobin.Select` |
|
||||
| 171 | method | `*weightedRoundRobin.Select` |
|
||||
| 244 | method | `*ipHash.Select` |
|
||||
| 248 | method | `*ipHash.SelectByIP` |
|
||||
|
||||
### internal/utils/httperror.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 26 | var | `ErrNotFound` |
|
||||
| 27 | var | `ErrForbidden` |
|
||||
| 28 | var | `ErrUnauthorized` |
|
||||
| 29 | var | `ErrBadGateway` |
|
||||
| 30 | var | `ErrGatewayTimeout` |
|
||||
| 31 | var | `ErrInternalError` |
|
||||
| 32 | var | `ErrTooManyRequests` |
|
||||
| 33 | var | `ErrServiceUnavailable` |
|
||||
|
||||
### internal/variable/builtin.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 19 | const | `VarHost` |
|
||||
| 20 | const | `VarRemoteAddr` |
|
||||
| 21 | const | `VarRemotePort` |
|
||||
| 22 | const | `VarRequestURI` |
|
||||
| 23 | const | `VarURI` |
|
||||
| 24 | const | `VarArgs` |
|
||||
| 25 | const | `VarRequestMethod` |
|
||||
| 26 | const | `VarScheme` |
|
||||
| 27 | const | `VarServerName` |
|
||||
| 28 | const | `VarServerPort` |
|
||||
| 29 | const | `VarStatus` |
|
||||
| 30 | const | `VarBodyBytesSent` |
|
||||
| 31 | const | `VarRequestTime` |
|
||||
| 32 | const | `VarTimeLocal` |
|
||||
| 33 | const | `VarTimeISO8601` |
|
||||
| 34 | const | `VarRequestID` |
|
||||
| 36 | const | `VarUpstreamAddr` |
|
||||
| 37 | const | `VarUpstreamStatus` |
|
||||
| 38 | const | `VarUpstreamResponseTime` |
|
||||
| 39 | const | `VarUpstreamConnectTime` |
|
||||
| 40 | const | `VarUpstreamHeaderTime` |
|
||||
|
||||
### internal/variable/ssl.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 24 | const | `VarSSLClientVerify` |
|
||||
| 25 | const | `VarSSLClientSerial` |
|
||||
| 26 | const | `VarSSLClientSubject` |
|
||||
| 27 | const | `VarSSLClientIssuer` |
|
||||
| 28 | const | `VarSSLClientFingerprint` |
|
||||
| 29 | const | `VarSSLClientNotBefore` |
|
||||
| 30 | const | `VarSSLClientNotAfter` |
|
||||
| 31 | const | `VarSSLClientDNS` |
|
||||
| 32 | const | `VarSSLClientEmail` |
|
||||
|
||||
### internal/version/version.go
|
||||
| 行号 | 类型 | 名称 |
|
||||
|------|------|------|
|
||||
| 9 | var | `Version` |
|
||||
| 11 | var | `GitCommit` |
|
||||
| 13 | var | `GitBranch` |
|
||||
| 15 | var | `BuildTime` |
|
||||
| 17 | var | `GoVersion` |
|
||||
| 19 | var | `BuildPlatform` |
|
||||
|
||||
---
|
||||
|
||||
## 统计汇总
|
||||
|
||||
| 类别 | 数量 |
|
||||
|------|------|
|
||||
| 公共 API(非 internal) | 2 |
|
||||
| internal 常量 | 134 |
|
||||
| internal 变量 | 14 |
|
||||
| internal 方法 | 14 |
|
||||
| internal 函数 | 1 |
|
||||
| **总计** | **180** |
|
||||
|
||||
---
|
||||
|
||||
*检测规则:导出的标识符(首字母大写)必须紧跟以该标识符名称开头的 `//` 文档注释,才被视为已文档化。`_test.go` 和 vendor 目录已排除。*
|
||||
@ -24,6 +24,9 @@
|
||||
// - Independent configuration instances via gjson.new()
|
||||
//
|
||||
// Author: xfy
|
||||
// Package gjson 提供 Go 模块信息。
|
||||
//
|
||||
// 作者:xfy
|
||||
package gjson
|
||||
|
||||
import (
|
||||
@ -32,10 +35,10 @@ import (
|
||||
|
||||
const (
|
||||
// ModuleName is the Lua module name for require()
|
||||
ModuleName = "gjson"
|
||||
// ModuleName 模块名称。 = "gjson"
|
||||
|
||||
// Version is the module version
|
||||
Version = "1.0.0"
|
||||
// Version 模块版本号。 = "1.0.0"
|
||||
)
|
||||
|
||||
// Preload registers the gjson module as a preload in the given LState.
|
||||
|
||||
@ -26,52 +26,52 @@ import (
|
||||
|
||||
// 日志级别常量(与 OpenResty/ngx_lua 兼容)
|
||||
const (
|
||||
LogStderr = 0
|
||||
LogEmerg = 1
|
||||
LogAlert = 2
|
||||
LogCrit = 3
|
||||
LogErr = 4
|
||||
LogWarn = 5
|
||||
LogNotice = 6
|
||||
LogInfo = 7
|
||||
LogDebug = 8
|
||||
// LogStderr 标准错误日志级别。 = 0
|
||||
// LogEmerg 紧急日志级别。 = 1
|
||||
// LogAlert 警报日志级别。 = 2
|
||||
// LogCrit 严重日志级别。 = 3
|
||||
// LogErr 错误日志级别。 = 4
|
||||
// LogWarn 警告日志级别。 = 5
|
||||
// LogNotice 通知日志级别。 = 6
|
||||
// LogInfo 信息日志级别。 = 7
|
||||
// LogDebug 调试日志级别。 = 8
|
||||
)
|
||||
|
||||
// HTTP 状态码常量
|
||||
const (
|
||||
HTTPContinue = 100
|
||||
HTTPSwitchingProtocols = 101
|
||||
HTTPOK = 200
|
||||
HTTPCreated = 201
|
||||
HTTPAccepted = 202
|
||||
HTTPNoContent = 204
|
||||
HTTPPartialContent = 206
|
||||
HTTPMovedPermanently = 301
|
||||
HTTPFound = 302
|
||||
HTTPSeeOther = 303
|
||||
HTTPNotModified = 304
|
||||
HTTPTemporaryRedirect = 307
|
||||
HTTPPermanentRedirect = 308
|
||||
HTTPBadRequest = 400
|
||||
HTTPUnauthorized = 401
|
||||
HTTPForbidden = 403
|
||||
HTTPNotFound = 404
|
||||
HTTPMethodNotAllowed = 405
|
||||
HTTPRequestTimeout = 408
|
||||
HTTPConflict = 409
|
||||
HTTPGone = 410
|
||||
HTTPLengthRequired = 411
|
||||
HTTPPayloadTooLarge = 413
|
||||
HTTPURITooLong = 414
|
||||
HTTPUnsupportedMedia = 415
|
||||
HTTPRangeNotSatisfiable = 416
|
||||
HTTPTooManyRequests = 429
|
||||
HTTPInternalServerError = 500
|
||||
HTTPNotImplemented = 501
|
||||
HTTPBadGateway = 502
|
||||
HTTPServiceUnavailable = 503
|
||||
HTTPGatewayTimeout = 504
|
||||
HTTPHTTPVersionNotSupported = 505
|
||||
// HTTPContinue HTTP 100 继续状态码。 = 100
|
||||
// HTTPSwitchingProtocols HTTP 101 切换协议状态码。 = 101
|
||||
// HTTPOK HTTP 200 成功状态码。 = 200
|
||||
// HTTPCreated HTTP 201 已创建状态码。 = 201
|
||||
// HTTPAccepted HTTP 202 已接受状态码。 = 202
|
||||
// HTTPNoContent HTTP 204 无内容状态码。 = 204
|
||||
// HTTPPartialContent HTTP 206 部分内容状态码。 = 206
|
||||
// HTTPMovedPermanently HTTP 301 永久重定向状态码。 = 301
|
||||
// HTTPFound HTTP 302 找到状态码。 = 302
|
||||
// HTTPSeeOther HTTP 303 查看其他状态码。 = 303
|
||||
// HTTPNotModified HTTP 304 未修改状态码。 = 304
|
||||
// HTTPTemporaryRedirect HTTP 307 临时重定向状态码。 = 307
|
||||
// HTTPPermanentRedirect HTTP 308 永久重定向状态码。 = 308
|
||||
// HTTPBadRequest HTTP 400 错误请求状态码。 = 400
|
||||
// HTTPUnauthorized HTTP 401 未授权状态码。 = 401
|
||||
// HTTPForbidden HTTP 403 禁止访问状态码。 = 403
|
||||
// HTTPNotFound HTTP 404 未找到状态码。 = 404
|
||||
// HTTPMethodNotAllowed HTTP 405 方法不允许状态码。 = 405
|
||||
// HTTPRequestTimeout HTTP 408 请求超时状态码。 = 408
|
||||
// HTTPConflict HTTP 409 冲突状态码。 = 409
|
||||
// HTTPGone HTTP 410 已移除状态码。 = 410
|
||||
// HTTPLengthRequired HTTP 411 需要长度状态码。 = 411
|
||||
// HTTPPayloadTooLarge HTTP 413 请求实体过大状态码。 = 413
|
||||
// HTTPURITooLong HTTP 414 URI 过长状态码。 = 414
|
||||
// HTTPUnsupportedMedia HTTP 415 不支持的媒体类型状态码。 = 415
|
||||
// HTTPRangeNotSatisfiable HTTP 416 范围不可满足状态码。 = 416
|
||||
// HTTPTooManyRequests HTTP 429 请求过多状态码。 = 429
|
||||
// HTTPInternalServerError HTTP 500 内部服务器错误状态码。 = 500
|
||||
// HTTPNotImplemented HTTP 501 未实现状态码。 = 501
|
||||
// HTTPBadGateway HTTP 502 错误网关状态码。 = 502
|
||||
// HTTPServiceUnavailable HTTP 503 服务不可用状态码。 = 503
|
||||
// HTTPGatewayTimeout HTTP 504 网关超时状态码。 = 504
|
||||
// HTTPHTTPVersionNotSupported HTTP 505 HTTP 版本不支持状态码。 = 505
|
||||
)
|
||||
|
||||
// ngxLogAPI 封装 ngx.log 和输出控制相关的 API。
|
||||
|
||||
@ -24,12 +24,18 @@ import "github.com/valyala/fasthttp"
|
||||
|
||||
// LocationType 常量定义,表示不同 location 匹配类型。
|
||||
const (
|
||||
LocationTypeExact = "exact" // 精确匹配 =
|
||||
LocationTypePrefix = "prefix" // 普通前缀匹配
|
||||
LocationTypePrefixPriority = "prefix_priority" // 前缀优先匹配 ^~
|
||||
LocationTypeRegex = "regex" // 正则匹配 ~
|
||||
LocationTypeRegexCaseless = "regex_caseless" // 大小写不敏感正则匹配 ~*
|
||||
LocationTypeNamed = "named" // 命名匹配 @name
|
||||
// LocationTypeExact 精确匹配类型(=)。
|
||||
LocationTypeExact = "exact"
|
||||
// LocationTypePrefix 前缀匹配类型。
|
||||
LocationTypePrefix = "prefix"
|
||||
// LocationTypePrefixPriority 前缀优先匹配类型(^~)。
|
||||
LocationTypePrefixPriority = "prefix_priority"
|
||||
// LocationTypeRegex 正则匹配类型(~)。
|
||||
LocationTypeRegex = "regex"
|
||||
// LocationTypeRegexCaseless 大小写不敏感正则匹配类型(~*)。
|
||||
LocationTypeRegexCaseless = "regex_caseless"
|
||||
// LocationTypeNamed 命名匹配类型(@name)。
|
||||
LocationTypeNamed = "named"
|
||||
)
|
||||
|
||||
// MatchResult 匹配结果。
|
||||
|
||||
@ -96,9 +96,9 @@ const streamingThreshold = 64 * 1024 // 64KB
|
||||
type Algorithm int
|
||||
|
||||
const (
|
||||
// AlgorithmGzip 使用 gzip 压缩。
|
||||
// AlgorithmGzip 使用 gzip 压缩算法。
|
||||
AlgorithmGzip Algorithm = iota
|
||||
// AlgorithmBrotli 使用 brotli 压缩。
|
||||
// AlgorithmBrotli 使用 brotli 压缩算法。
|
||||
AlgorithmBrotli
|
||||
|
||||
compressionGZIP = "gzip"
|
||||
|
||||
@ -23,14 +23,14 @@ type HTTPError struct {
|
||||
|
||||
// Predefined common HTTP errors.
|
||||
var (
|
||||
ErrNotFound = HTTPError{Message: "Not Found", StatusCode: fasthttp.StatusNotFound}
|
||||
ErrForbidden = HTTPError{Message: "Forbidden", StatusCode: fasthttp.StatusForbidden}
|
||||
ErrUnauthorized = HTTPError{Message: "Unauthorized", StatusCode: fasthttp.StatusUnauthorized}
|
||||
ErrBadGateway = HTTPError{Message: "Bad Gateway", StatusCode: fasthttp.StatusBadGateway}
|
||||
ErrGatewayTimeout = HTTPError{Message: "Gateway Timeout", StatusCode: fasthttp.StatusGatewayTimeout}
|
||||
ErrInternalError = HTTPError{Message: "Internal Server Error", StatusCode: fasthttp.StatusInternalServerError}
|
||||
ErrTooManyRequests = HTTPError{Message: "Too Many Requests", StatusCode: fasthttp.StatusTooManyRequests}
|
||||
ErrServiceUnavailable = HTTPError{Message: "Service Unavailable", StatusCode: fasthttp.StatusServiceUnavailable}
|
||||
// ErrNotFound 资源未找到错误。 = HTTPError{Message: "Not Found", StatusCode: fasthttp.StatusNotFound}
|
||||
// ErrForbidden 禁止访问错误。 = HTTPError{Message: "Forbidden", StatusCode: fasthttp.StatusForbidden}
|
||||
// ErrUnauthorized 未授权错误。 = HTTPError{Message: "Unauthorized", StatusCode: fasthttp.StatusUnauthorized}
|
||||
// ErrBadGateway 错误网关错误。 = HTTPError{Message: "Bad Gateway", StatusCode: fasthttp.StatusBadGateway}
|
||||
// ErrGatewayTimeout 网关超时错误。 = HTTPError{Message: "Gateway Timeout", StatusCode: fasthttp.StatusGatewayTimeout}
|
||||
// ErrInternalError 内部服务器错误。 = HTTPError{Message: "Internal Server Error", StatusCode: fasthttp.StatusInternalServerError}
|
||||
// ErrTooManyRequests 请求过多错误。 = HTTPError{Message: "Too Many Requests", StatusCode: fasthttp.StatusTooManyRequests}
|
||||
// ErrServiceUnavailable 服务不可用错误。 = HTTPError{Message: "Service Unavailable", StatusCode: fasthttp.StatusServiceUnavailable}
|
||||
)
|
||||
|
||||
// SendError sends an HTTP error response to the client.
|
||||
|
||||
@ -16,28 +16,28 @@ import (
|
||||
|
||||
// 内置变量常量
|
||||
const (
|
||||
VarHost = "host"
|
||||
VarRemoteAddr = "remote_addr"
|
||||
VarRemotePort = "remote_port"
|
||||
VarRequestURI = "request_uri"
|
||||
VarURI = "uri"
|
||||
VarArgs = "args"
|
||||
VarRequestMethod = "request_method"
|
||||
VarScheme = "scheme"
|
||||
VarServerName = "server_name"
|
||||
VarServerPort = "server_port"
|
||||
VarStatus = "status"
|
||||
VarBodyBytesSent = "body_bytes_sent"
|
||||
VarRequestTime = "request_time"
|
||||
VarTimeLocal = "time_local"
|
||||
VarTimeISO8601 = "time_iso8601"
|
||||
VarRequestID = "request_id"
|
||||
// VarHost 请求主机名变量。 = "host"
|
||||
// VarRemoteAddr 客户端地址变量。 = "remote_addr"
|
||||
// VarRemotePort 客户端端口变量。 = "remote_port"
|
||||
// VarRequestURI 请求 URI 变量。 = "request_uri"
|
||||
// VarURI URI 变量。 = "uri"
|
||||
// VarArgs 查询参数变量。 = "args"
|
||||
// VarRequestMethod 请求方法变量。 = "request_method"
|
||||
// VarScheme 协议方案变量。 = "scheme"
|
||||
// VarServerName 服务器名称变量。 = "server_name"
|
||||
// VarServerPort 服务器端口变量。 = "server_port"
|
||||
// VarStatus HTTP 状态码变量。 = "status"
|
||||
// VarBodyBytesSent 发送字节数变量。 = "body_bytes_sent"
|
||||
// VarRequestTime 请求处理时间变量。 = "request_time"
|
||||
// VarTimeLocal 本地时间变量。 = "time_local"
|
||||
// VarTimeISO8601 ISO8601 时间变量。 = "time_iso8601"
|
||||
// VarRequestID 请求 ID 变量。 = "request_id"
|
||||
// 上游变量
|
||||
VarUpstreamAddr = "upstream_addr"
|
||||
VarUpstreamStatus = "upstream_status"
|
||||
VarUpstreamResponseTime = "upstream_response_time"
|
||||
VarUpstreamConnectTime = "upstream_connect_time"
|
||||
VarUpstreamHeaderTime = "upstream_header_time"
|
||||
// VarUpstreamAddr 上游地址变量。 = "upstream_addr"
|
||||
// VarUpstreamStatus 上游状态码变量。 = "upstream_status"
|
||||
// VarUpstreamResponseTime 上游响应时间变量。 = "upstream_response_time"
|
||||
// VarUpstreamConnectTime 上游连接时间变量。 = "upstream_connect_time"
|
||||
// VarUpstreamHeaderTime 上游响应头时间变量。 = "upstream_header_time"
|
||||
)
|
||||
|
||||
// init 注册所有内置变量
|
||||
|
||||
@ -21,14 +21,23 @@ import (
|
||||
|
||||
// SSL 变量常量
|
||||
const (
|
||||
// VarSSLClientVerify SSL 客户端证书验证结果变量。
|
||||
VarSSLClientVerify = "ssl_client_verify"
|
||||
// VarSSLClientSerial SSL 客户端证书序列号变量。
|
||||
VarSSLClientSerial = "ssl_client_serial"
|
||||
// VarSSLClientSubject SSL 客户端证书主题变量。
|
||||
VarSSLClientSubject = "ssl_client_subject"
|
||||
// VarSSLClientIssuer SSL 客户端证书颁发者变量。
|
||||
VarSSLClientIssuer = "ssl_client_issuer"
|
||||
// VarSSLClientFingerprint SSL 客户端证书指纹变量。
|
||||
VarSSLClientFingerprint = "ssl_client_fingerprint"
|
||||
// VarSSLClientNotBefore SSL 客户端证书生效时间变量。
|
||||
VarSSLClientNotBefore = "ssl_client_notbefore"
|
||||
// VarSSLClientNotAfter SSL 客户端证书过期时间变量。
|
||||
VarSSLClientNotAfter = "ssl_client_notafter"
|
||||
// VarSSLClientDNS SSL 客户端证书主题 DN 变量。
|
||||
VarSSLClientDNS = "ssl_client_s_dn"
|
||||
// VarSSLClientEmail SSL 客户端证书邮箱变量。
|
||||
VarSSLClientEmail = "ssl_client_email"
|
||||
|
||||
sslProtocolNone = "NONE"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user