2026-05-16 08:12:42 +08:00

74 lines
2.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package auth
const (
// LoginIPRiskStatusPending 表示任务已落库但尚未被 worker claim。
LoginIPRiskStatusPending = "pending"
// LoginIPRiskStatusRunning 表示任务已被某个 worker 租约锁定。
LoginIPRiskStatusRunning = "running"
// LoginIPRiskStatusCompleted 表示任务已有 blocked/allowed/unknown 决策。
LoginIPRiskStatusCompleted = "completed"
// LoginIPRiskStatusFailed 表示本次处理失败,后续可按锁和 attempt 重试。
LoginIPRiskStatusFailed = "failed"
// LoginIPRiskStatusSkipped 表示已有新鲜决策,本任务不再访问 provider。
LoginIPRiskStatusSkipped = "skipped"
// LoginIPRiskDecisionBlocked 表示 IP 国家命中不支持国家。
LoginIPRiskDecisionBlocked = "blocked"
// LoginIPRiskDecisionAllowed 表示 IP 国家未命中不支持国家。
LoginIPRiskDecisionAllowed = "allowed"
// LoginIPRiskDecisionUnknown 表示 provider 全部不可用或没有可解析国家。
LoginIPRiskDecisionUnknown = "unknown"
)
// LoginIPRiskJob 是登录成功后异步复核入口 IP 的持久任务。
type LoginIPRiskJob struct {
AppCode string
JobID string
SessionID string
UserID int64
ClientIP string
ClientIPHash string
Channel string
Platform string
Language string
Timezone string
RequestID string
EdgeCountryCode string
Status string
Decision string
CountryCode string
FailureReason string
LockedBy string
LockedUntilMs int64
AttemptCount int
CreatedAtMs int64
UpdatedAtMs int64
}
// LoginIPRiskDecision 记录一次 IP Geo 决策Redis 只保存它的快查投影。
type LoginIPRiskDecision struct {
AppCode string
DecisionID string
ClientIP string
ClientIPHash string
Decision string
CountryCode string
Confidence int
ProviderAttemptsJSON string
DecidedAtMs int64
ExpiresAtMs int64
CreatedAtMs int64
}
// LoginRiskCountryBlock 是后台维护的国家屏蔽词事实。
// CountryCode 为空时仅作为客户端词表下发;服务端 IP 风控只能稳定消费 provider 返回的国家码。
type LoginRiskCountryBlock struct {
AppCode string
BlockID int64
Keyword string
CountryCode string
Enabled bool
CreatedAtMs int64
UpdatedAtMs int64
}