dnscache

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 2 Imported by: 0

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.

func New

func New(ttl time.Duration, max int) *Cache

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) Len

func (c *Cache) Len() int

Len reports the number of cached mappings.

func (*Cache) Lookup

func (c *Cache) Lookup(ip string) string

Lookup returns the hostname for ip, or "" if unknown or expired.

func (*Cache) Put

func (c *Cache) Put(ip, host string)

Put records that ip resolves to host. The most recent mapping wins.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL