Documentation
¶
Overview ¶
Package dnsstatus reports, for each DNS record a feature needs, whether it is live, still waiting, different or blocked, and what the zone already holds.
Index ¶
Constants ¶
const ( EnvLookupTimeout = "APP_DNS_STATUS_LOOKUP_TIMEOUT" EnvProviderTimeout = "APP_DNS_STATUS_PROVIDER_TIMEOUT" EnvConcurrency = "APP_DNS_STATUS_CONCURRENCY" EnvCacheSeconds = "APP_DNS_STATUS_CACHE_SECONDS" )
Env knobs for public DNS checks and the result cache.
const ( Live = "live" Waiting = "waiting" Different = "different" Conflict = "conflict" Unknown = "unknown" )
Record statuses.
const ( SourceProvider = "provider" SourcePublicDNS = "public_dns" )
Where the found records came from.
Variables ¶
This section is empty.
Functions ¶
func JoinTXT ¶
JoinTXT rejoins a TXT value written as quoted strings (DKIM and SPF are often split into 255 byte chunks) into the single string receivers see.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache reuses a result for a few seconds and coalesces identical concurrent requests, so a retry burst does one round of lookups. The zero value is ready.
type Counts ¶
type Counts struct {
Live int `json:"live"`
Waiting int `json:"waiting"`
Different int `json:"different"`
Conflict int `json:"conflict"`
Unknown int `json:"unknown"`
Total int `json:"total"`
}
Counts tallies records by status.
type Found ¶
type Found struct {
Type string `json:"type"`
Name string `json:"name"`
Value string `json:"value"`
TTL int `json:"ttl,omitempty"`
Proxied *bool `json:"proxied,omitempty"`
}
Found is one record that already exists at the name.
type Options ¶
Options bounds public DNS checks.
func OptionsFromEnv ¶
func OptionsFromEnv() Options
OptionsFromEnv reads the lookup timeouts and concurrency from env.
type Record ¶
type Record struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Value string `json:"value"`
TTL int `json:"ttl"`
Priority *int `json:"priority,omitempty"`
Status string `json:"status"`
Found []Found `json:"found"`
Reason string `json:"reason,omitempty"`
CheckedAt string `json:"checked_at"`
}
Record is the live status of one wanted record.
type Resolver ¶
type Resolver interface {
LookupTXT(ctx context.Context, name string) ([]string, error)
LookupCNAME(ctx context.Context, name string) (string, error)
LookupMX(ctx context.Context, name string) ([]*net.MX, error)
LookupHost(ctx context.Context, host string) ([]string, error)
LookupSRV(ctx context.Context, service, proto, name string) (string, []*net.SRV, error)
}
Resolver is the slice of net.Resolver a public DNS check needs.
type Status ¶
type Status struct {
ProviderSource string `json:"provider_source"`
CheckedAt string `json:"checked_at"`
Counts Counts `json:"counts"`
Records []Record `json:"records"`
// DelegationWarning means the records come from a provider zone public DNS does not use yet.
DelegationWarning bool `json:"delegation_warning,omitempty"`
DelegationReason string `json:"delegation_reason,omitempty"`
}
Status is the per-record report plus its counts and source.
func FromResolver ¶
FromResolver grades wants against public DNS, a bounded number of lookups at a time.
type Want ¶
type Want struct {
ID string
Type string
Name string
Value string
TTL int
Priority *int
// Reach adds names that must stay unproxied for this record to work (mta-sts).
Reach []string
}
Want is one record a feature needs. Name is absolute without a trailing dot; MX and SRV carry the priority separately from Value.
type ZoneOptions ¶
type ZoneOptions struct {
// Shadow lists names mail must reach directly; a proxied record there is a conflict.
Shadow map[string]bool
// ProxyAware is true when the provider has a proxy flag, so false is meaningful.
ProxyAware bool
}
ZoneOptions tunes FromZone.