錯誤與回應
最後更新
本頁說明 Redis 或查詢失敗時 IPGuardian.Check 的行為,以及中介層拒絕請求時回傳的 JSON 內容。
錯誤處理邊界
| 情境 | 行為 |
|---|---|
| Redis 在評分階段失敗 | dynamicScore 回傳 nil 與錯誤,Check 只記錄錯誤後讀取 score.IsBlock,造成 nil pointer panic,見 已知問題 |
| Allow/Deny 查詢 Redis 失敗 | 回退記憶體快取 |
| Block 查詢 Redis 失敗 | 視為未封鎖(fail-open) |
| 每分鐘計數失敗 | 計數視為 1 |
回應格式
Check 回傳 IPGuardianResult;兩個中介層把失敗結果轉成 JSON:
{"error": "Device is banned, IP: 198.51.100.77"}
自行呼叫 Check 的寫法見 中介層。
判定順序與速率分級見 請求流程。