Documentation ¶
Overview ¶
Package ipcache provides a time-based cache object to keep track of recently-seen IP addresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // IPCacheTimeout sets a lower bound on the amount of time between subsequent traceroutes to a single IP address. IPCacheTimeout = flag.Duration("IPCacheTimeout", 120*time.Second, "Timeout duration in seconds for IPCache") // IPCacheUpdatePeriod determines how long to wait between cache-scrubbing attempts. IPCacheUpdatePeriod = flag.Duration("IPCacheUpdatePeriod", 1*time.Second, "We run the cache eviction loop with this frequency") )
Functions ¶
This section is empty.
Types ¶
type CacheTest ¶ added in v0.2.1
type CacheTest struct {
// contains filtered or unexported fields
}
type RecentIPCache ¶
type RecentIPCache struct {
// contains filtered or unexported fields
}
RecentIPCache contains a list of all the IP addresses that we have traced to recently. We keep this list to ensure that we don't traceroute to the same location repeatedly at a high frequency.
func New ¶
func New(ctx context.Context) *RecentIPCache
New creates and returns a RecentIPCache. It also starts up a background goroutine that scrubs the cache.
func (*RecentIPCache) GetCacheLength ¶ added in v0.2.1
func (rc *RecentIPCache) GetCacheLength() int
func (*RecentIPCache) GetTestContent ¶ added in v0.2.1
func (rc *RecentIPCache) GetTestContent(ip string) string
func (*RecentIPCache) Has ¶
func (m *RecentIPCache) Has(ip string) bool
Has tests whether an IP is in the cache.
func (*RecentIPCache) Trace ¶ added in v0.2.1
func (rc *RecentIPCache) Trace(conn connection.Connection, sc scamper.Tracer)
GetTrace returns test content in []byte given a connection and tracer
Click to show internal directories.
Click to hide internal directories.