Documentation
¶
Overview ¶
Package dnscache maps remote IP addresses back to the hostnames the local machine resolved them from. netscope can only see IPs on the wire; by sniffing DNS responses it recovers the human-meaningful domain for each flow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a bounded, TTL'd IP -> hostname map. Safe for concurrent use.
Entries are kept in a list ordered by when they were last seen, oldest at the front, so eviction is a pop rather than a scan. That matters on the packet path: a laptop that has been up for a few days runs this cache full, and full is where every DNS answer and every SNI hit used to pay an O(n) walk over 20 000 entries to find the one to drop.
func New ¶
New returns a Cache. ttl bounds how long a mapping is trusted after it was last observed; max bounds the number of retained entries.
func (*Cache) LoadFrom ¶ added in v0.6.0
LoadFrom merges mappings from a file written by SaveTo, preserving each entry's original "seen" time (so the TTL still applies) and dropping any that have already expired. A missing file is not an error.