Skip to content

Releases: 2234839/DynaPM

v1.0.15

Choose a tag to compare

@github-actions github-actions released this 22 Mar 06:28

🚀 性能优化

  • typeof 替代 Array.isArray: 响应头转发中 4 处 Array.isArray(value) 替换为 typeof value === 'string',V8 内置类型检查比原型链遍历快 41%
  • getCaseSensitiveMethod() 消除热路径 toUpperCase(): uWS getMethod() 返回小写方法名,改为直接使用 getCaseSensitiveMethod() 获取原始大小写
  • 404 路径提前返回: handleRequest 中 hostname 查找提前到 header 收集之前,404 请求跳过不必要的 CPU 和内存开销
  • CRLF 快速路径: 热路径中用 includes('\r') || includes('\n') 快速检查跳过正则替换
  • 移除 node-fetch 依赖: 使用 Node.js 22 内置 fetch API
  • 预计算 targetPort: RouteMapping 中缓存目标端口,避免每次 parseInt

🔴 Bug 修复

  • activeConnections 双重递减: cleanup() 添加 cleaned 守卫防止多次触发
  • 代理请求 timeout 未处理: proxyReq 监听 timeout 事件并 destroy()
  • 502 vs 504 区分: 代理请求超时返回 504 Gateway Timeout,连接错误返回 502
  • startService fire-and-forget 竞态: serviceManager.start() 改为 await,避免端口短暂可用时错误标记为 online
  • WebSocket handler 无条件日志修复: open 回调中的 JSON.stringify 日志添加 enableWebSocketLog 守卫
  • test-startup-recovery 闲置超时测试修复: 等待时间从 14s 增加到 16s,修复时序敏感测试偶发失败

✅ 代码质量

  • 消除所有 any 类型: test-all.tstest-proxy-comprehensive.tstest-gateway-robustness.tstest-pilot.tscommand-executor.ts 中的 any 替换为 unknown + instanceof 类型守卫
  • Admin API method.toLowerCase() 移除: uWS getMethod() 返回小写方法名,5 处冗余 toLowerCase() 已移除
  • Admin API findServiceMapping O(n) → O(1): 懒初始化 serviceName → RouteMapping 索引 Map
  • getServicesList 消除重复遍历: 使用预构建的服务名称索引 Map
  • health-checker.ts 消除循环内 new URL(): 预解析 URL 对象,传入 host/port 参数
  • Buffer.allocBuffer.allocUnsafe: collectRequestBodyhandleDirectProxy 中使用 allocUnsafe 跳过清零

🧪 测试(224 个用例全部通过,22 个测试套件)

  • 新增 test-gateway-resilience.ts: 8 个网关韧性与边界深度测试
  • 新增 test-crlf-fastpath.ts: 11 个 CRLF 安全性验证测试
  • 新增 test-gzip-passthrough.ts: 5 个 Gzip 压缩响应透传测试
  • 新增 test-startservice-race.ts: 6 个 startService 竞态条件测试
  • 新增 test-port-ws-proxy.ts: 10 个端口绑定 WebSocket 代理测试
  • 新增 test-admin-api-deep.ts: 10 个管理 API 深度测试
  • 新增 test-gateway-boundary.ts: 10 个网关边界与安全测试
  • 新增 test-proxy-deep.ts: 10 个代理深度与资源管理测试
  • 新增 test-proxy-edge-paths.ts: 10 个代理边缘路径测试
  • 新增 test-concurrent-post-body.ts: 10 个并发与竞争条件测试
  • 新增 test-proxy-supplementary.ts: 10 个代理场景补充测试
  • 新增 test-ws-concurrent.ts: 10 个 WebSocket 并发与稳定性测试

v1.0.14

Choose a tag to compare

@github-actions github-actions released this 20 Mar 11:55

🔴 Bug 修复

  • 按需启动 POST 请求体丢失(严重): uWS 的 onData 回调中 ArrayBuffer 是借用语义,Buffer.from(ab) 底层数据被后续回调覆盖。改用 Buffer.alloc + copy 确保数据复制
  • 并发按需启动返回 502: 多个请求同时到达离线服务时,只有第一个触发启动,其他请求等待启动完成后再代理
  • transfer-encoding 头冲突: forwardProxyRequest 中过滤 transfer-encoding 头,避免与 content-length 冲突导致后端 400
  • 后端崩溃自动恢复: 检测到后端不可达(ECONNREFUSED)时,自动将非 proxyOnly 服务状态重置为 offline
  • 端口路由并发启动: handlePortBindingRequest 补全 starting/stopping 状态处理,与 hostname 路由保持一致

🔒 安全加固

  • 请求体大小限制 10MB,防止 DoS 攻击
  • WebSocket 消息队列限制 1000 条,防止内存泄漏
  • CRLF 注入防护:请求头值中的 \r\n 被清理
  • 端口路由 WebSocket close handler 补充后端连接清理

🚀 性能优化

  • 去除 undici,恢复原生 http 模块: 吞吐量从 4,523 提升至 5,942 req/s(+31%),延迟从 10.6ms 降至 10.3ms
  • 预编译 CRLF 正则,避免热路径重复创建
  • Set 替代内联条件判断,优化请求头跳过逻辑

🧪 测试(81 个用例全部通过)

  • test-proxy-comprehensive.ts: 23 个综合代理测试
  • test-edge-cases.ts: 15 个极端场景测试
  • test-gateway-robustness.ts: 13 个健壮性测试
  • test-admin-api-lifecycle.ts: 12 个管理 API 生命周期测试
  • test-port-route-start.ts: 9 个端口路由按需启动测试
  • test-security-stability.ts: 9 个安全与稳定性深度测试

v1.0.13

Choose a tag to compare

@github-actions github-actions released this 10 Feb 14:19

🚀 性能优化

  • 重大性能提升:使用 undici 替代原生 http 模块作为 HTTP 客户端
    • 吞吐量提升 28.2%:4345 → 5571 req/s
    • 延迟保持 11.4ms(无退化)
    • 使用 undici.request() API 实现流式转发
    • 避免了 undici.stream() + Writable stream 的包装开销

🔧 改进

  • 移除不再使用的 http/https 模块相关代码
  • 清理 RouteMapping 中的冗余字段(isHttps、httpModule、httpAgent)
  • 代码更简洁,维护性更好

📚 技术细节

  • undici 的 request() API 比 stream() API 更适合代理场景
  • stream() 适用于消费响应(写入文件、解析 JSON)
  • request() 返回 Readable stream,可以手动控制流式转发
  • 完全保持流式处理,客户端延迟无增加

v1.0.12

Choose a tag to compare

@github-actions github-actions released this 10 Feb 02:51

✨ 新增

  • 添加 proxyOnly 配置项,支持纯反向代理模式
    • 不管理服务生命周期(启动/停止)
    • 仅做请求转发,适合已运行的服务

🔧 改进

  • WebSocket 代理正确转发客户端请求路径
  • WebSocket 代理完整转发客户端请求头(Cookie、Authorization 等)
  • 改进 WebSocket 错误处理,避免连接重试循环
  • 添加 TypeScript 测试配置支持

v1.0.11

Choose a tag to compare

@github-actions github-actions released this 10 Feb 02:20

🔧 修复

  • 修复 tag 版本号提取,正确匹配 CHANGELOG 格式
    • 添加步骤去掉 tag 的 v 前缀
    • mindsers/changelog-reader-action 现在接收纯数字版本号

v1.0.8

Choose a tag to compare

@github-actions github-actions released this 10 Feb 02:14
1.0.8

v1.0.7

Choose a tag to compare

@github-actions github-actions released this 10 Feb 02:08

📦 Release v1.0.7