checker-reverse-zone/checker/types.go

60 lines
1.9 KiB
Go

package checker
import (
"encoding/json"
"github.com/miekg/dns"
)
const ObservationKey = "reverse-zone"
type ForwardAddress struct {
Type string `json:"type"` // "A" or "AAAA"
Address string `json:"address"`
TTL uint32 `json:"ttl,omitempty"`
}
type PTREntry struct {
OwnerName string `json:"owner_name"` // FQDN of the PTR record (e.g. "42.1.168.192.in-addr.arpa.")
ReverseIP string `json:"reverse_ip,omitempty"`
Subdomain string `json:"subdomain,omitempty"`
Targets []string `json:"targets"`
TTL uint32 `json:"ttl,omitempty"`
TargetSyntaxValid bool `json:"target_syntax_valid,omitempty"`
TargetLooksGeneric bool `json:"target_looks_generic,omitempty"`
ForwardAddresses []ForwardAddress `json:"forward_addresses,omitempty"`
ForwardMatch bool `json:"forward_match,omitempty"`
TargetResolves bool `json:"target_resolves,omitempty"`
ForwardError string `json:"forward_error,omitempty"`
}
type ReverseZoneData struct {
Zone string `json:"zone"`
IsReverseZone bool `json:"is_reverse_zone"`
IsIPv6 bool `json:"is_ipv6"`
PTRCount int `json:"ptr_count"`
Entries []PTREntry `json:"entries,omitempty"` // capped to maxPTRsToCheck
Truncated bool `json:"truncated,omitempty"`
LoadError string `json:"load_error,omitempty"` // structural failure preventing collection
}
// ptrService mirrors happyDomain's `svcs.PTR`.
type ptrService struct {
Record *dns.PTR `json:"Record"`
}
// serviceMessage mirrors happyDomain's per-service envelope inside a Zone.
type serviceMessage struct {
Type string `json:"_svctype"`
Service json.RawMessage `json:"Service"`
}
// zoneMessage mirrors the subset of happyDomain's Zone needed here.
type zoneMessage struct {
DefaultTTL uint32 `json:"default_ttl"`
Services map[string][]serviceMessage `json:"services"`
}