Documentation
¶
Overview ¶
Package iprev checks if an IP has a reverse DNS name configured and that the reverse DNS name resolves back to the IP (RFC 8601, Section 3).
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRecord = errors.New("iprev: no reverse dns record") ErrDNS = errors.New("iprev: dns lookup") // Temporary error. )
Lookup errors.
View Source
var (
MetricIPRev stub.HistogramVec = stub.HistogramVecIgnore{}
)
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status string
Status is the result of a lookup.
const ( StatusPass Status = "pass" // Reverse and forward lookup results were in agreement. StatusFail Status = "fail" // Reverse and forward lookup results were not in agreement, but at least the reverse name does exist. StatusTemperror Status = "temperror" // Temporary error, e.g. DNS timeout. StatusPermerror Status = "permerror" // Permanent error and later retry is unlikely to succeed. E.g. no PTR record. )
func Lookup ¶
func Lookup(ctx context.Context, resolver dns.Resolver, ip net.IP) (rstatus Status, name string, names []string, authentic bool, rerr error)
Lookup checks whether an IP has a proper reverse & forward DNS configuration. I.e. that it is explicitly associated with its domain name.
A PTR lookup is done on the IP, resulting in zero or more names. These names are forward resolved (A or AAAA) until the original IP address is found. The first matching name is returned as "name". All names, matching or not, are returned as "names".
If a temporary error occurred, rerr is set.
Click to show internal directories.
Click to hide internal directories.