( ip: string, privacy: FreeModeIpPrivacy | null, )
| 264 | } |
| 265 | |
| 266 | function setSpurPrivacyCache( |
| 267 | ip: string, |
| 268 | privacy: FreeModeIpPrivacy | null, |
| 269 | ): void { |
| 270 | while (spurPrivacyCache.size >= IPINFO_PRIVACY_CACHE_MAX_ENTRIES) { |
| 271 | const oldestIp = spurPrivacyCache.keys().next().value |
| 272 | if (!oldestIp) break |
| 273 | spurPrivacyCache.delete(oldestIp) |
| 274 | } |
| 275 | |
| 276 | spurPrivacyCache.set(ip, { |
| 277 | expiresAt: Date.now() + IPINFO_PRIVACY_CACHE_TTL_MS, |
| 278 | privacy, |
| 279 | }) |
| 280 | } |
| 281 | |
| 282 | function privacySignalsFromIpinfo( |
| 283 | data: Record<string, unknown>, |
no test coverage detected