Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMaxNamesReached = errors.New("dns reverse max names reached")
ErrMaxNamesReached is thrown when the capacity of the names map is reached
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [16]byte
Address is the comparable type-alias for the IP v4/v6 addresses
func AddressFromIP ¶
AddressFromIP constructs the address from the IP address.
func (Address) ToIPString ¶
ToIPString converts the address to IP string representation.
type ReverseDNS ¶
type ReverseDNS struct {
// contains filtered or unexported fields
}
ReverseDNS performs reverse DNS resolutions and keeps the cache of resolved IP to domain mappings.
func NewReverseDNS ¶
func NewReverseDNS(size int, ttl, exp time.Duration) *ReverseDNS
NewReverseDNS creates a new DNS reverser with the specified size and TTL period.
func (*ReverseDNS) Add ¶
func (r *ReverseDNS) Add(addr Address) ([]string, error)
Add performs a reverse lookup for the given address, returning a list of names mapping to that address. It assigns a ttl to the names value and puts it in the map. If the names map capacity is reached this method returns an error and gives up on adding new entries.
func (*ReverseDNS) Expire ¶
func (r *ReverseDNS) Expire()
Expire evicts name values that are eligible for expiration.
func (*ReverseDNS) Get ¶
func (r *ReverseDNS) Get(addr Address) []string
Get returns all the name mappings for the specified address.