(ip string)
| 50 | } |
| 51 | |
| 52 | func (t *IPTracker) IsLocked(ip string) bool { |
| 53 | t.mu.Lock() |
| 54 | defer t.mu.Unlock() |
| 55 | |
| 56 | record, exists := t.records[ip] |
| 57 | if !exists { |
| 58 | return false |
| 59 | } |
| 60 | |
| 61 | if !t.prepareRecordUnsafe(ip, record) { |
| 62 | t.removeIPUnsafe(ip) |
| 63 | return false |
| 64 | } |
| 65 | |
| 66 | return time.Now().Before(record.LockedUntil) |
| 67 | } |
| 68 | |
| 69 | func (t *IPTracker) SetNeedCaptcha(ip string) { |
| 70 | t.mu.Lock() |
no test coverage detected