(ip string)
| 33 | } |
| 34 | |
| 35 | func (t *IPTracker) NeedCaptcha(ip string) bool { |
| 36 | t.mu.Lock() |
| 37 | defer t.mu.Unlock() |
| 38 | |
| 39 | record, exists := t.records[ip] |
| 40 | if !exists { |
| 41 | return false |
| 42 | } |
| 43 | |
| 44 | if !t.prepareRecordUnsafe(ip, record) { |
| 45 | t.removeIPUnsafe(ip) |
| 46 | return false |
| 47 | } |
| 48 | |
| 49 | return record.NeedCaptcha |
| 50 | } |
| 51 | |
| 52 | func (t *IPTracker) IsLocked(ip string) bool { |
| 53 | t.mu.Lock() |
no test coverage detected