Documentation ¶
Overview ¶
Package lru implements an LRU cache.
Index ¶
- Variables
- func ListConatins(iplist []*net.IPNet, ip net.IP) bool
- func ParseLine(line string) (ipnet *net.IPNet, err error)
- type Cache
- type DNSCache
- type FilterPair
- type FilteredDialer
- func (fd *FilteredDialer) Dial(network, address string) (conn net.Conn, err error)
- func (fd *FilteredDialer) DialTimeout(network, address string, timeout time.Duration) (conn net.Conn, err error)
- func (fd *FilteredDialer) Getaddrs(hostname string) (ips []net.IP)
- func (fd *FilteredDialer) LoadFilter(dialer common.Dialer, filename string) (err error)
- type IPFilter
- type Key
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDNSNotFound = errors.New("dns not found") ErrType = errors.New("type error") )
Functions ¶
Types ¶
type Cache ¶
type Cache struct { // MaxEntries is the maximum number of cache entries before // an item is evicted. Zero means no limit. MaxEntries int // OnEvicted optionally specificies a callback function to be // executed when an entry is purged from the cache. OnEvicted func(key Key, value interface{}) // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func New ¶
New creates a new Cache. If maxEntries is zero, the cache has no limit and it's assumed that eviction is done by the caller.
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.
type DNSCache ¶
func CreateDNSCache ¶
type FilterPair ¶
type FilteredDialer ¶
type FilteredDialer struct {
// contains filtered or unexported fields
}
func NewFilteredDialer ¶
func NewFilteredDialer(def common.Dialer, resolver common.Resolver) (fd *FilteredDialer)
func (*FilteredDialer) Dial ¶
func (fd *FilteredDialer) Dial(network, address string) (conn net.Conn, err error)
func (*FilteredDialer) DialTimeout ¶
func (*FilteredDialer) Getaddrs ¶
func (fd *FilteredDialer) Getaddrs(hostname string) (ips []net.IP)
func (*FilteredDialer) LoadFilter ¶
func (fd *FilteredDialer) LoadFilter(dialer common.Dialer, filename string) (err error)
type IPFilter ¶
type IPFilter struct {
// contains filtered or unexported fields
}
func ReadIPListFile ¶
type Key ¶
type Key interface{}
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
Click to show internal directories.
Click to hide internal directories.