使用 Go 1.18+ 泛型特性优化对象池,提高类型安全性和性能。 - 将 bufPool 和 ctxPool 升级为使用已有的泛型池实现 - 移除所有 Get() 操作后的类型断言 - 保持 API 兼容性,确保现有代码无需大量修改 - 优化流数据传输中内存使用 性能改进: - 减少运行时类型检查开销 - 消除了类型断言导致的潜在 panic 风险 - 优化了高并发场景下的内存分配模式
30 lines
689 B
JSON
30 lines
689 B
JSON
[
|
|
{
|
|
"pattern": "/api/v1/",
|
|
"replacement": "/api/v2/",
|
|
"use_regex": false,
|
|
"description": "将API v1请求重定向到v2",
|
|
"enabled": true
|
|
},
|
|
{
|
|
"pattern": "/old/(.*)/page",
|
|
"replacement": "/new/$1/page",
|
|
"use_regex": true,
|
|
"description": "旧页面格式重定向到新格式",
|
|
"enabled": true
|
|
},
|
|
{
|
|
"pattern": "/legacy-files/",
|
|
"replacement": "/files/",
|
|
"use_regex": false,
|
|
"description": "旧文件路径重定向",
|
|
"enabled": false
|
|
},
|
|
{
|
|
"pattern": "^/(en|zh|ja)/(.*)",
|
|
"replacement": "/$2?lang=$1",
|
|
"use_regex": true,
|
|
"description": "将语言路径转换为查询参数",
|
|
"enabled": true
|
|
}
|
|
] |