2025-12-29 17:46:52 +08:00
|
|
|
|
// Package ctxkey 定义用于 context.Value 的类型安全 key
|
|
|
|
|
|
package ctxkey
|
|
|
|
|
|
|
|
|
|
|
|
// Key 定义 context key 的类型,避免使用内置 string 类型(staticcheck SA1029)
|
|
|
|
|
|
type Key string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
// ForcePlatform 强制平台(用于 /antigravity 路由),由 middleware.ForcePlatform 设置
|
|
|
|
|
|
ForcePlatform Key = "ctx_force_platform"
|
2026-01-09 20:51:41 +08:00
|
|
|
|
|
|
|
|
|
|
// ClientRequestID 客户端请求的唯一标识,用于追踪请求全生命周期(用于 Ops 监控与排障)。
|
|
|
|
|
|
ClientRequestID Key = "ctx_client_request_id"
|
|
|
|
|
|
|
|
|
|
|
|
// RetryCount 表示当前请求在网关层的重试次数(用于 Ops 记录与排障)。
|
|
|
|
|
|
RetryCount Key = "ctx_retry_count"
|
2026-01-11 10:59:01 +08:00
|
|
|
|
|
2026-01-28 00:01:03 +08:00
|
|
|
|
// AccountSwitchCount 表示请求过程中发生的账号切换次数
|
|
|
|
|
|
AccountSwitchCount Key = "ctx_account_switch_count"
|
|
|
|
|
|
|
2026-01-11 10:59:01 +08:00
|
|
|
|
// IsClaudeCodeClient 标识当前请求是否来自 Claude Code 客户端
|
|
|
|
|
|
IsClaudeCodeClient Key = "ctx_is_claude_code_client"
|
2026-01-09 23:01:42 +08:00
|
|
|
|
// Group 认证后的分组信息,由 API Key 认证中间件设置
|
|
|
|
|
|
Group Key = "ctx_group"
|
2025-12-29 17:46:52 +08:00
|
|
|
|
)
|