1. 27 Mar, 2026 1 commit
    • shaw's avatar
      feat(tls-fingerprint): 新增 TLS 指纹 Profile 数据库管理及代码质量优化 · 1854050d
      shaw authored
      新增功能:
      - 新增 TLS 指纹 Profile CRUD 管理(Ent schema + 迁移 + Admin API + 前端管理界面)
      - 支持账号绑定数据库中的自定义 TLS Profile,或随机选择(profile_id=-1)
      - HTTPUpstream.DoWithTLS 接口从 bool 改为 *tlsfingerprint.Profile,支持按账号指定 Profile
      - AccountUsageService 注入 TLSFingerprintProfileService,统一 usage 场景与网关的 Profile 解析逻辑
      
      代码优化:
      - 删除已被 TLSFingerprintProfileService 完全取代的 registry.go 死代码(418 行)
      - 提取 3 个 dialer 的重复 TLS 握手逻辑为 performTLSHandshake() 共用函数
      - 修复 GetTLSFingerprintProfileID 缺少 json.Number 处理的 bug
      - gateway_service.Forward 中 ResolveTLSProfile 从重试循环内重复调用改为预解析局部变量
      - 删除冗余的 buildClientHelloSpec() 单行 wrapper 和 int64(e.ID) 无效转换
      - tls_fingerprint_profile_cache.go 日志从 log.Printf 改为 slog 结构化日志
      - dialer_capture_test.go 添加 //go:build integration 标签,防止 CI 失败
      - 去重 TestProfileExpectation 类型至共享 test_types_test.go
      - 修复 9 个测试文件缺少 tlsfingerprint import 的编译错误
      - 修复 error_policy_integration_test.go 中 handleError 回调签名被错误替换的问题
      1854050d
  2. 05 Mar, 2026 1 commit
    • erio's avatar
      fix: include upstream error details in usage API error response · 9117c2a4
      erio authored
      When FetchUsageWithOptions receives a non-200 response from the
      Anthropic API (e.g. 429 Rate Limited, 401 Unauthorized), the error
      was wrapped with fmt.Errorf which infraerrors.FromError cannot
      recognize, causing a generic "internal error" message with no details.
      
      Replace fmt.Errorf with infraerrors.New(500, "UPSTREAM_ERROR", msg)
      so the upstream error details (status code + body) are included in
      the 500 response message. The HTTP status remains 500 to avoid
      interfering with frontend auth routing (e.g. 401 would trigger
      JWT expiry redirect).
      9117c2a4
  3. 02 Mar, 2026 1 commit
    • QTom's avatar
      feat(proxy): 集中代理 URL 验证并实现全局 fail-fast · fdcbf7aa
      QTom authored
      提取 proxyurl.Parse() 公共包,将分散在 6 处的代理 URL 验证逻辑
      统一收敛,确保无效代理配置在创建时立即失败,永不静默回退直连。
      
      主要变更:
      - 新增 proxyurl 包:统一 TrimSpace → url.Parse → Host 校验 → Scheme 白名单
      - socks5:// 自动升级为 socks5h://,防止 DNS 泄漏(大小写不敏感)
      - antigravity: http.ProxyURL → proxyutil.ConfigureTransportProxy 支持 SOCKS5
      - openai_oauth: 删除 newOpenAIOAuthHTTPClient,收编至 httpclient.GetClient
      - 移除未使用的 ProxyStrict 字段(fail-fast 已是全局默认行为)
      - 补充 15 个 proxyurl 测试 + pricing/usage fail-fast 测试
      fdcbf7aa
  4. 02 Feb, 2026 1 commit
  5. 19 Jan, 2026 1 commit
  6. 03 Jan, 2026 1 commit
    • yangjianbo's avatar
      fix(安全): 修复上游校验与 URL 清理问题 · 25e16326
      yangjianbo authored
      增加请求阶段 DNS 解析校验,阻断重绑定到私网
      补充默认透传 WWW-Authenticate 头,保留认证挑战
      前端相对 URL 过滤拒绝 // 协议相对路径
      
      测试: go test ./internal/repository -run TestGitHubReleaseServiceSuite
      测试: go test ./internal/repository -run TestTurnstileServiceSuite
      测试: go test ./internal/repository -run TestProxyProbeServiceSuite
      测试: go test ./internal/repository -run TestClaudeUsageServiceSuite
      25e16326
  7. 31 Dec, 2025 1 commit
    • yangjianbo's avatar
      perf(后端): 完成性能优化与连接池配置 · 7efa8b54
      yangjianbo authored
      新增 DB/Redis 连接池配置与校验,并补充单测
      
      网关请求体大小限制与 413 处理
      
      HTTP/req 客户端池化并调整上游连接池默认值
      
      并发槽位改为 ZSET+Lua 与指数退避
      
      用量统计改 SQL 聚合并新增索引迁移
      
      计费缓存写入改工作池并补测试/基准
      
      测试: 在 backend/ 下运行 go test ./...
      7efa8b54
  8. 25 Dec, 2025 1 commit
  9. 24 Dec, 2025 1 commit
  10. 20 Dec, 2025 3 commits
    • Forest's avatar
      ci(backend): 添加 errcheck 配置 · 0338c83b
      Forest authored
      0338c83b
    • NepetaLemon's avatar
      ci(backend): 添加 github actions (#10) · c6b3de11
      NepetaLemon authored
      ## 变更内容
      
      ### CI/CD
      - 添加 GitHub Actions 工作流(test + golangci-lint)
      - 添加 golangci-lint 配置,启用 errcheck/govet/staticcheck/unused/depguard
      - 通过 depguard 强制 service 层不能直接导入 repository
      
      ### 错误处理修复
      - 修复 CSV 写入、SSE 流式输出、随机数生成等未处理的错误
      - GenerateRedeemCode() 现在返回 error
      
      ### 资源泄露修复
      - 统一使用 defer func() { _ = xxx.Close() }() 模式
      
      ### 代码清理
      - 移除未使用的常量
      - 简化 nil map 检查
      - 统一代码格式
      c6b3de11
    • Forest's avatar
      refactor(backend): service http ports · cceada7d
      Forest authored
      cceada7d