class

Fetcher::ValidatedIpStore

Inherits Reference < Object

Encapsulates the validated IP cache used for DNS rebinding mitigation. Keeps mutation localized behind a Mutex and provides a small API used by Fetcher::URLValidator. This lets URLValidator remain a facade while the cache implementation is easier to replace (actor, external store, etc.).

Constructors

new(max_entries : Int32 = 10000, ttl : Time::Span = 5.seconds)
Source

Instance methods

check_rebinding(host : String, current_ip : Socket::IPAddress) : Bool | Nil

Check for rebinding. Returns:

  • true/false if there was a recent entry for this host (entry.ip == current_ip);
  • nil if no recent entry existed (caller may then perform additional checks).
Source
clear

Clear entire store.

Source
max_entries
Source
purge_expired(expiry : Time::Span | Nil = nil) : Nil

Purge expired entries older than provided expiry (or the store's ttl). Called implicitly by register when approaching max capacity (80%).

Source
register(host : String, ip : Socket::IPAddress) : Nil

Register a host -> ip mapping with current timestamp.

Source

Nested types