docs(matcher): 为 location 匹配引擎添加标准化 godoc 注释

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-20 11:23:03 +08:00
parent 1c3e04afdb
commit 10f3da0954
3 changed files with 13 additions and 12 deletions

View File

@ -4,10 +4,10 @@
// 按照 nginx 优先级顺序执行匹配。
//
// 匹配优先级从高到低:
// 1. 精确匹配(=
// 2. 前缀优先匹配(^~
// 3. 正则匹配(~, ~*
// 4. 普通前缀匹配
// 1. 精确匹配(=
// 2. 前缀优先匹配(^~
// 3. 正则匹配(~, ~*
// 4. 普通前缀匹配
//
// 作者xfy
package matcher
@ -181,10 +181,10 @@ func (e *LocationEngine) AddNamed(name string, handler fasthttp.RequestHandler)
// Match 统一匹配入口。
//
// 按照 nginx 优先级顺序执行匹配:
// 1. 精确匹配(=- O(1)
// 2. 前缀优先匹配(^~- O(log n)
// 3. 正则匹配(~, ~*- 按顺序
// 4. 普通前缀匹配 - O(log n)
// 1. 精确匹配(=- O(1)
// 2. 前缀优先匹配(^~- O(log n)
// 3. 正则匹配(~, ~*- 按顺序
// 4. 普通前缀匹配 - O(log n)
//
// 参数:
// - path: 请求路径

View File

@ -8,8 +8,9 @@
// - 命名匹配named@name 形式的内部跳转目标
//
// 主要用途:
// 用于反向代理模块根据请求路径选择对应的后端处理器,
// 优先级顺序与 nginx 一致:精确 > 前缀优先(^~) > 正则(~,~*) > 普通前缀
//
// 用于反向代理模块根据请求路径选择对应的后端处理器,
// 优先级顺序与 nginx 一致:精确 > 前缀优先(^~) > 正则(~,~*) > 普通前缀
//
// 注意事项:
// - Radix Tree 在初始化完成后不可修改MarkInitialized 后 Insert 返回错误)

View File

@ -214,8 +214,8 @@ func (t *RadixTree) FindLongestPrefix(path string) *MatchResult {
// searchLongest 递归搜索最长前缀匹配。
//
// 匹配规则:
// 1. 优先级数值越小越优先
// 2. 相同优先级时,前缀越长越优先
// 1. 优先级数值越小越优先
// 2. 相同优先级时,前缀越长越优先
//
// 参数:
// - node: 当前搜索节点