Documentation
¶
Index ¶
- Constants
- func CanonicalizeTargets(recs []*RecordConfig, origin string)
- func DecodeLuaPayload(payload string) (string, error)
- func Downcase(recs []*RecordConfig)
- func FixPosition(str string) string
- func IsBuilder(name string) bool
- func MakeA(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeAAAA(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeALIAS(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeCAA(origin string, metadata map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeCNAME(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeDHCID(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeDNAME(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeDNSKEY(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeDS(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeHTTPS(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeLOC(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeMIKROTIKFWD(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeMIKROTIKNXDOMAIN(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeMX(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeNAPTR(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeNS(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeOPENPGPKEY(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakePORKBUNURLFWD(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakePTR(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeR53ALIAS(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeRP(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeSMIMEA(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeSOA(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeSRV(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeSSHFP(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeSVCB(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeTLSA(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeTXT(origin string, _ map[string]string, isEnabled nrc.Flags, args ...any) (dnsv2.RDATA, error)
- func MakeUnknown(rc *RecordConfig, rtype string, contents string, origin string) error
- func MyNewData(typeNum uint16, contents string, origin string) (dnsv2.RDATA, error)
- func NameserversToStrings(nss []*Nameserver) (s []string)
- func ParseLuaContent(content string) (rtype string, payload string)
- func PostProcessRecords(recs []*RecordConfig)
- func RegisterBuilder(typeName string, genFn RecordBuilderFn)
- func ReverseAltitude(packedAltitude uint32) float64
- func ReverseENotationInt(packedValue uint8) float64
- func ReverseLatitude(lat uint32) (string, uint8, uint8, float64)
- func ReverseLongitude(lon uint32) (string, uint8, uint8, float64)
- func SVCBHydrateDesiredEchIgnore(existing, desired Records)
- func Svcbv2ValueToString(pairs []svcbv2.Pair) string
- func TXTJoined(rd dnsrdatav2.TXT) string
- func TXTSegmented(rd dnsrdatav2.TXT) []string
- func WarnNameserverDot(p, w string)
- type Correction
- type DNSConfig
- type DNSProvider
- type DNSProviderConfig
- type DNSProviderInstance
- type DomainConfig
- func (dc *DomainConfig) AddRecordConfig(rc *RecordConfig)
- func (dc *DomainConfig) AddTestRC(t *testing.T, label string, ttl uint32, typeNum uint16, args ...any) *RecordConfig
- func (dc *DomainConfig) AddTestRCParse(label string, ttl uint32, typeNum uint16, contents string) *RecordConfig
- func (dc *DomainConfig) Copy() (*DomainConfig, error)
- func (dc *DomainConfig) DomainNameVarieties() *domaintags.DomainNameVarieties
- func (dc *DomainConfig) Filter(f func(r *RecordConfig) bool)
- func (dc *DomainConfig) FixLegacyDC()
- func (dc *DomainConfig) GetChangeCount(providerName string) int
- func (dc *DomainConfig) GetCorrections(providerName string) []*Correction
- func (dc *DomainConfig) GetPopulateCorrections(providerName string) []*Correction
- func (dc *DomainConfig) GetSplitHorizonNames() (name, uniquename, tag string)
- func (dc *DomainConfig) GetUniqueName() (uniquename string)
- func (dc *DomainConfig) IncrementChangeCount(providerName string, delta int)
- func (dc *DomainConfig) LabelFromDnsconfigjs(rawLabel, subdomainASCII string) (string, error)
- func (dc *DomainConfig) LabelFromFQDNNoDot(name string) string
- func (dc *DomainConfig) LabelFromFQDNWithDot(name string) string
- func (dc *DomainConfig) LabelFromShort(name string) string
- func (dc *DomainConfig) MustNewRecordConfig(name string, ttl uint32, typeAny any, args ...any) *RecordConfig
- func (dc *DomainConfig) MustNewRecordConfigParse(name string, ttl uint32, typeAny any, data string) *RecordConfig
- func (dc *DomainConfig) NewRecordConfig(name string, ttl uint32, typeAny any, args ...any) (*RecordConfig, error)
- func (dc *DomainConfig) NewRecordConfigForRRv2toRC(name string, ttl uint32, typeNum uint16, rd dnsv2.RDATA) (*RecordConfig, error)
- func (dc *DomainConfig) NewRecordConfigParse(name string, ttl uint32, typeAny any, data string, rcflag ...nrc.Flags) (*RecordConfig, error)
- func (dc *DomainConfig) PopulateNamesFromRaw(rawname string)
- func (dc *DomainConfig) PostProcess()
- func (dc *DomainConfig) Punycode() error
- func (dc *DomainConfig) StoreCorrections(providerName string, corrections []*Correction)
- func (dc *DomainConfig) StorePopulateCorrections(providerName string, corrections []*Correction)
- func (dc *DomainConfig) ToFqdnNoDot(s string) string
- func (dc *DomainConfig) ToFqdnWithDot(s string) string
- func (dc *DomainConfig) ToShort(name string) string
- type Nameserver
- type ProviderBase
- type RawRecordConfig
- type RecordBuilderFn
- type RecordConfig
- func (rc *RecordConfig) AsA() dnsrdatav2.A
- func (rc *RecordConfig) AsAAAA() dnsrdatav2.AAAA
- func (rc *RecordConfig) AsADGUARDHOMEAAAAPASSTHROUGH() privatetypesrdata.ADGUARDHOMEAAAAPASSTHROUGH
- func (rc *RecordConfig) AsADGUARDHOMEAPASSTHROUGH() privatetypesrdata.ADGUARDHOMEAPASSTHROUGH
- func (rc *RecordConfig) AsAFSDB() dnsrdatav2.AFSDB
- func (rc *RecordConfig) AsAKAMAICDN() privatetypesrdata.AKAMAICDN
- func (rc *RecordConfig) AsAKAMAITLC() privatetypesrdata.AKAMAITLC
- func (rc *RecordConfig) AsALIAS() privatetypesrdata.ALIAS
- func (rc *RecordConfig) AsAVC() dnsrdatav2.TXT
- func (rc *RecordConfig) AsAZUREALIAS() privatetypesrdata.AZUREALIAS
- func (rc *RecordConfig) AsBUNNYDNSPZ() privatetypesrdata.BUNNYDNSPZ
- func (rc *RecordConfig) AsCAA() dnsrdatav2.CAA
- func (rc *RecordConfig) AsCDNSKEY() dnsrdatav2.DNSKEY
- func (rc *RecordConfig) AsCDS() dnsrdatav2.DS
- func (rc *RecordConfig) AsCERT() dnsrdatav2.CERT
- func (rc *RecordConfig) AsCFWORKERROUTE() privatetypesrdata.CFWORKERROUTE
- func (rc *RecordConfig) AsCLA() dnsrdatav2.TXT
- func (rc *RecordConfig) AsCLOUDFLAREAPISINGLEREDIRECT() privatetypesrdata.CLOUDFLAREAPISINGLEREDIRECT
- func (rc *RecordConfig) AsCLOUDNSWR() privatetypesrdata.CLOUDNSWR
- func (rc *RecordConfig) AsCNAME() dnsrdatav2.CNAME
- func (rc *RecordConfig) AsCSYNC() dnsrdatav2.CSYNC
- func (rc *RecordConfig) AsDELEG() dnsrdatav2.DELEG
- func (rc *RecordConfig) AsDELEGPARAM() dnsrdatav2.DELEG
- func (rc *RecordConfig) AsDHCID() dnsrdatav2.DHCID
- func (rc *RecordConfig) AsDLV() dnsrdatav2.DS
- func (rc *RecordConfig) AsDNAME() dnsrdatav2.DNAME
- func (rc *RecordConfig) AsDNSKEY() dnsrdatav2.DNSKEY
- func (rc *RecordConfig) AsDS() dnsrdatav2.DS
- func (rc *RecordConfig) AsDSYNC() dnsrdatav2.DSYNC
- func (rc *RecordConfig) AsEID() dnsrdatav2.EID
- func (rc *RecordConfig) AsEUI48() dnsrdatav2.EUI48
- func (rc *RecordConfig) AsEUI64() dnsrdatav2.EUI64
- func (rc *RecordConfig) AsFRAME() privatetypesrdata.FRAME
- func (rc *RecordConfig) AsGID() dnsrdatav2.GID
- func (rc *RecordConfig) AsGPOS() dnsrdatav2.GPOS
- func (rc *RecordConfig) AsHINFO() dnsrdatav2.HINFO
- func (rc *RecordConfig) AsHIP() dnsrdatav2.HIP
- func (rc *RecordConfig) AsHTTPS() dnsrdatav2.SVCB
- func (rc *RecordConfig) AsIPN() dnsrdatav2.IPN
- func (rc *RecordConfig) AsISDN() dnsrdatav2.ISDN
- func (rc *RecordConfig) AsKEY() dnsrdatav2.DNSKEY
- func (rc *RecordConfig) AsKX() dnsrdatav2.KX
- func (rc *RecordConfig) AsL32() dnsrdatav2.L32
- func (rc *RecordConfig) AsL64() dnsrdatav2.L64
- func (rc *RecordConfig) AsLOC() dnsrdatav2.LOC
- func (rc *RecordConfig) AsLP() dnsrdatav2.LP
- func (rc *RecordConfig) AsLUA() privatetypesrdata.LUA
- func (rc *RecordConfig) AsMB() dnsrdatav2.MB
- func (rc *RecordConfig) AsMD() dnsrdatav2.MD
- func (rc *RecordConfig) AsMF() dnsrdatav2.MF
- func (rc *RecordConfig) AsMG() dnsrdatav2.MG
- func (rc *RecordConfig) AsMIKROTIKFORWARDER() privatetypesrdata.MIKROTIKFORWARDER
- func (rc *RecordConfig) AsMIKROTIKFWD() privatetypesrdata.MIKROTIKFWD
- func (rc *RecordConfig) AsMINFO() dnsrdatav2.MINFO
- func (rc *RecordConfig) AsMR() dnsrdatav2.MR
- func (rc *RecordConfig) AsMX() dnsrdatav2.MX
- func (rc *RecordConfig) AsNAPTR() dnsrdatav2.NAPTR
- func (rc *RecordConfig) AsNID() dnsrdatav2.NID
- func (rc *RecordConfig) AsNIMLOC() dnsrdatav2.NIMLOC
- func (rc *RecordConfig) AsNINFO() dnsrdatav2.NINFO
- func (rc *RecordConfig) AsNS() dnsrdatav2.NS
- func (rc *RecordConfig) AsNSAPPTR() dnsrdatav2.NSAPPTR
- func (rc *RecordConfig) AsNSEC() dnsrdatav2.NSEC
- func (rc *RecordConfig) AsNSEC3() dnsrdatav2.NSEC3
- func (rc *RecordConfig) AsNSEC3PARAM() dnsrdatav2.NSEC3PARAM
- func (rc *RecordConfig) AsNULL() dnsrdatav2.NULL
- func (rc *RecordConfig) AsNXT() dnsrdatav2.NSEC
- func (rc *RecordConfig) AsOPENPGPKEY() dnsrdatav2.OPENPGPKEY
- func (rc *RecordConfig) AsPORKBUNURLFWD() privatetypesrdata.PORKBUNURLFWD
- func (rc *RecordConfig) AsPTR() dnsrdatav2.PTR
- func (rc *RecordConfig) AsPX() dnsrdatav2.PX
- func (rc *RecordConfig) AsR53ALIAS() privatetypesrdata.R53ALIAS
- func (rc *RecordConfig) AsRESINFO() dnsrdatav2.TXT
- func (rc *RecordConfig) AsRKEY() dnsrdatav2.RKEY
- func (rc *RecordConfig) AsRP() dnsrdatav2.RP
- func (rc *RecordConfig) AsRRSIG() dnsrdatav2.RRSIG
- func (rc *RecordConfig) AsRT() dnsrdatav2.RT
- func (rc *RecordConfig) AsSIG() dnsrdatav2.RRSIG
- func (rc *RecordConfig) AsSMIMEA() dnsrdatav2.SMIMEA
- func (rc *RecordConfig) AsSOA() dnsrdatav2.SOA
- func (rc *RecordConfig) AsSPF() dnsrdatav2.TXT
- func (rc *RecordConfig) AsSRV() dnsrdatav2.SRV
- func (rc *RecordConfig) AsSSHFP() dnsrdatav2.SSHFP
- func (rc *RecordConfig) AsSVCB() dnsrdatav2.SVCB
- func (rc *RecordConfig) AsTA() dnsrdatav2.TA
- func (rc *RecordConfig) AsTALINK() dnsrdatav2.TALINK
- func (rc *RecordConfig) AsTKEY() dnsrdatav2.TKEY
- func (rc *RecordConfig) AsTLSA() dnsrdatav2.TLSA
- func (rc *RecordConfig) AsTSIG() dnsrdatav2.TSIG
- func (rc *RecordConfig) AsTXT() dnsrdatav2.TXT
- func (rc *RecordConfig) AsUID() dnsrdatav2.UID
- func (rc *RecordConfig) AsUINFO() dnsrdatav2.UINFO
- func (rc *RecordConfig) AsURI() dnsrdatav2.URI
- func (rc *RecordConfig) AsURL() privatetypesrdata.URL
- func (rc *RecordConfig) AsURL301() privatetypesrdata.URL301
- func (rc *RecordConfig) AsWALLET() dnsrdatav2.TXT
- func (rc *RecordConfig) AsX25() dnsrdatav2.X25
- func (rc *RecordConfig) AsZONEMD() dnsrdatav2.ZONEMD
- func (rc *RecordConfig) ChangeType(newType string, _ string)
- func (rc *RecordConfig) ClearRDATA()
- func (rc *RecordConfig) Copy() (*RecordConfig, error)
- func (rc *RecordConfig) FixRD(origin string)
- func (rc *RecordConfig) GetDependencies() []string
- func (rc *RecordConfig) GetLabel() string
- func (rc *RecordConfig) GetLabelFQDN() string
- func (rc *RecordConfig) GetRDATA() (rd dnsv2.RDATA)
- func (rc *RecordConfig) GetTargetCombined() string
- func (rc *RecordConfig) GetTargetCombinedFunc(encodeFn func(s string) string) string
- func (rc *RecordConfig) GetTargetDebug() string
- func (rc *RecordConfig) GetTargetField() string
- func (rc *RecordConfig) GetTargetIP() netip.Addr
- func (rc *RecordConfig) GetTargetJS() string
- func (rc *RecordConfig) GetTargetTXTJoined() string
- func (rc *RecordConfig) GetTargetTXTSegmentCount() int
- func (rc *RecordConfig) GetTargetTXTSegmented() []string
- func (rc *RecordConfig) HasFormatIdenticalToTXT() bool
- func (rc *RecordConfig) IsTTLSignificant() bool
- func (rc *RecordConfig) Key() RecordKey
- func (rc *RecordConfig) LineString() string
- func (rc *RecordConfig) MarshalJSON() ([]byte, error)
- func (rc *RecordConfig) MustSetTarget(target string)
- func (rc *RecordConfig) RecomputeV3Fields(origin string)
- func (rc *RecordConfig) RegenerateComparableV3()
- func (rc *RecordConfig) SetLabel(short, origin string)
- func (rc *RecordConfig) SetLabelFromFQDN(fqdn, origin string)
- func (rc *RecordConfig) SetRDATA(rd dnsv2.RDATA)
- func (rc *RecordConfig) SetTarget(target string) error
- func (rc *RecordConfig) SetTargetIP(ip netip.Addr) error
- func (rc *RecordConfig) SetTargetTXT(s string) error
- func (rc *RecordConfig) SetTargetTXTs(s []string) error
- func (rc *RecordConfig) ToComparableNoTTL() string
- func (rc *RecordConfig) ToRRv2() dnsv2.RR
- func (rc *RecordConfig) UnmarshalJSON(b []byte) error
- type RecordDB
- type RecordKey
- type Records
- func (recs Records) FixLegacyRecords(origin string)
- func (recs Records) GetAllDependencies() []string
- func (recs Records) GetByType(typeName string) Records
- func (recs Records) GroupedByFQDN() ([]string, map[string]Records)
- func (recs Records) GroupedByKey() map[RecordKey]Records
- func (recs Records) HasRecordTypeName(rtype, name string) bool
- func (recs Records) StringEach() []string
- type Registrar
- type RegistrarConfig
- type RegistrarInstance
- type UnmanagedConfig
Constants ¶
const DefaultTTL = uint32(300)
DefaultTTL is applied to any DNS record without an explicit TTL.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeTargets ¶
func CanonicalizeTargets(recs []*RecordConfig, origin string)
CanonicalizeTargets turns Targets into FQDNs.
func DecodeLuaPayload ¶
DecodeLuaPayload normalizes the LUA payload for storage in RecordConfig.target.
func Downcase ¶
func Downcase(recs []*RecordConfig)
Downcase converts all labels and targets to lowercase in a list of RecordConfig. NB(tlim): This should go away once all rtypes are modernized. The Make*() functions should do all downcasing, etc.
func FixPosition ¶
FixPosition takes the string representation of a position in a file that comes from dnsconfig.js's initial execution, and reduces it down to just the line/position we display to the user. The input is not well-defined, thus if we find something we don't expect, we just return the original input. TODO: Move this to rtypecontrol or a similar package.
func MakeDNSKEY ¶
func MakeMIKROTIKFWD ¶
func MakeMIKROTIKNXDOMAIN ¶
func MakeOPENPGPKEY ¶
func MakePORKBUNURLFWD ¶
func MakeR53ALIAS ¶
func MakeSMIMEA ¶
func MakeUnknown ¶
func MakeUnknown(rc *RecordConfig, rtype string, contents string, origin string) error
MakeUnknown turns an RecordConfig into an UNKNOWN type.
func NameserversToStrings ¶
func NameserversToStrings(nss []*Nameserver) (s []string)
NameserversToStrings constructs a list of strings from *Nameserver structs.
func ParseLuaContent ¶
ParseLuaContent splits a PowerDNS LUA record content string into its emitted rtype and payload.
func PostProcessRecords ¶
func PostProcessRecords(recs []*RecordConfig)
PostProcessRecords does any post-processing of the downloaded DNS records. Deprecated. zonerecords.CorrectZoneRecords() calls Downcase directly.
func RegisterBuilder ¶
func RegisterBuilder(typeName string, genFn RecordBuilderFn)
RegisterBuilder registers a fake type that generates one or more RecordConfigs.
func ReverseAltitude ¶
ReverseAltitude takes the packed altitude and returns the altitude in meters.
func ReverseENotationInt ¶
ReverseENotationInt produces a number from a mantissa_exponent 4bits:4bits uint8.
func ReverseLatitude ¶
ReverseLatitude takes the packed latitude and returns the hemisphere, degrees, minutes, and seconds.
func ReverseLongitude ¶
ReverseLongitude takes the packed longitude and returns the hemisphere, degrees, minutes, and seconds.
func SVCBHydrateDesiredEchIgnore ¶
func SVCBHydrateDesiredEchIgnore(existing, desired Records)
SVCBHydrateDesiredEchIgnore finds any ECH=IGNORE parameters (stored as ECH=1000) and substitute the existing ECH value instead.
func Svcbv2ValueToString ¶
Svcbv2ValueToString converts a SVCB value list to a string. Typical usage: models.Svcbv2ValueToString(rc.AsHTTPS().Value) Does NOT generate quotes around values in key=value pairs.
func TXTJoined ¶
func TXTJoined(rd dnsrdatav2.TXT) string
TXTJoined returns all the character-strings in a TXT RDATA as one string.
func TXTSegmented ¶
func TXTSegmented(rd dnsrdatav2.TXT) []string
TXTSegmented returns a TXT RDATA in DNSControl's canonical form: the character-strings are joined and then split into 255-octet segments. Empty input is represented by one empty segment.
func WarnNameserverDot ¶
func WarnNameserverDot(p, w string)
WarnNameserverDot prints a warning about issue 491 never more than once.
Types ¶
type Correction ¶
Correction is anything that can be run. Implementation is up to the specific provider.
type DNSConfig ¶
type DNSConfig struct {
Registrars []*RegistrarConfig `json:"registrars"`
DNSProviders []*DNSProviderConfig `json:"dns_providers"`
Domains []*DomainConfig `json:"domains"`
RegistrarsByName map[string]*RegistrarConfig `json:"-"`
DNSProvidersByName map[string]*DNSProviderConfig `json:"-"`
SkipRecordAudit bool `json:"skiprecordaudit,omitempty"`
}
DNSConfig describes the desired DNS configuration, usually loaded from dnsconfig.js.
func (*DNSConfig) FindDomain ¶
func (config *DNSConfig) FindDomain(query string) *DomainConfig
FindDomain returns the *DomainConfig for domain query in config.
func (*DNSConfig) ImportRawRecords ¶
ImportRawRecords iterates over the dc.RawRecords from each domain, converting each to a RecordConfig and deleting the raw version (to save memory). This is how records get from dnsconfig.js to dc.Records.
func (*DNSConfig) PostProcess ¶
PostProcess performs and post-processing required after running dnsconfig.js and loading the result.
type DNSProvider ¶
type DNSProvider interface {
GetNameservers(domain string) ([]*Nameserver, error)
GetZoneRecords(dc *DomainConfig) (Records, error)
GetZoneRecordsCorrections(dc *DomainConfig, existing Records) ([]*Correction, int, error)
}
DNSProvider is an interface for DNS Provider plug-ins.
type DNSProviderConfig ¶
type DNSProviderConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Metadata json.RawMessage `json:"meta,omitempty"`
}
DNSProviderConfig describes a DNS service provider.
type DNSProviderInstance ¶
type DNSProviderInstance struct {
ProviderBase
Driver DNSProvider
NumberOfNameservers int
}
DNSProviderInstance is a single DNS provider.
type DomainConfig ¶
type DomainConfig struct {
NameRaw string `json:"-"` // name as entered by user in dnsconfig.js
Name string `json:"name"` // NO trailing "." Converted to IDN (punycode) early in the pipeline.
NameUnicode string `json:"-"` // name in Unicode format
Tag string `json:"tag,omitempty"` // Split horizon tag.
UniqueName string `json:"uniquename"` // .Name + "!" + .Tag (no !tag added if tag is "")
DisplayName string `json:"-"` // For TUI display: "canonical!tag" or "canonical!tag (unicode)"
RegistrarName string `json:"registrar"`
DNSProviderNames map[string]int `json:"dnsProviders"`
Metadata map[string]string `json:"meta,omitempty"`
Records Records `json:"records"`
Nameservers []*Nameserver `json:"nameservers,omitempty"`
NameserversMutex sync.Mutex `json:"-"`
EnsureAbsent Records `json:"recordsabsent,omitempty"` // ENSURE_ABSENT
KeepUnknown bool `json:"keepunknown,omitempty"` // NO_PURGE
Unmanaged []*UnmanagedConfig `json:"unmanaged,omitempty"` // IGNORE()
UnmanagedUnsafe bool `json:"unmanaged_disable_safety_check,omitempty"` // DISABLE_IGNORE_SAFETY_CHECK
IgnoreExternalDNS bool `json:"ignore_external_dns,omitempty"` // IGNORE_EXTERNAL_DNS
ExternalDNSPrefix string `json:"external_dns_prefix,omitempty"` // IGNORE_EXTERNAL_DNS prefix
AutoDNSSEC string `json:"auto_dnssec,omitempty"` // "", "on", "off"
// These fields contain instantiated provider instances once everything is linked up.
// This linking is in two phases:
// 1. Metadata (name/type) is available just from the dnsconfig. Validation can use that.
// 2. Final driver instances are loaded after we load credentials. Any actual provider interaction requires that.
RegistrarInstance *RegistrarInstance `json:"-"`
DNSProviderInstances []*DNSProviderInstance `json:"-"`
// Raw user-input from dnsconfig.js that will be processed into RecordConfigs later:
RawRecords []RawRecordConfig `json:"rawrecords,omitempty"`
// contains filtered or unexported fields
}
DomainConfig describes a DNS domain (technically a DNS zone). Do not create your own `&models.DomainConfig{}`. Use `models.NewDomainConfig(name)`.
func MustNewDomainConfig ¶
func MustNewDomainConfig(name string) *DomainConfig
MustNewDomainConfig is like NewDomainConfig but panics if initialization fails. It is intended for use in variable initializations in unit tests.
func NewDomainConfig ¶
func NewDomainConfig(name string) (*DomainConfig, error)
NewDomainConfig creates and initializes a *models.DomainConfig.
func (*DomainConfig) AddRecordConfig ¶
func (dc *DomainConfig) AddRecordConfig(rc *RecordConfig)
func (*DomainConfig) AddTestRC ¶
func (dc *DomainConfig) AddTestRC(t *testing.T, label string, ttl uint32, typeNum uint16, args ...any) *RecordConfig
AddTestRC is a convenience function that uses models.NewRecordConfig() to create a models.RecordConfig and adds it to a models.DomainConfig. It is for use in unit tests. It panics on error. It returns a pointer to the newly-created RecordConfig, and adds it to rc.Records. If this is not a test, consider dc.AddRecordConfig().
func (*DomainConfig) AddTestRCParse ¶
func (dc *DomainConfig) AddTestRCParse(label string, ttl uint32, typeNum uint16, contents string) *RecordConfig
AddTestRCParse is a convenience function that uses models.NewRecordConfigParse() to create a models.RecordConfig and adds it to a models.DomainConfig. It is for use in unit tests. It panics on error. It returns a pointer to the newly-created RecordConfig, and adds it to rc.Records. If this is not a test, consider dc.AddRecordConfig(). It returns a pointer to the newly-created RecordConfig, and adds it to rc.Records.
func (*DomainConfig) Copy ¶
func (dc *DomainConfig) Copy() (*DomainConfig, error)
Copy returns a deep copy of the DomainConfig.
func (*DomainConfig) DomainNameVarieties ¶
func (dc *DomainConfig) DomainNameVarieties() *domaintags.DomainNameVarieties
DomainNameVarieties returns the domain's names in various forms.
func (*DomainConfig) Filter ¶
func (dc *DomainConfig) Filter(f func(r *RecordConfig) bool)
Filter removes all records that don't match the filter f.
func (*DomainConfig) FixLegacyDC ¶
func (dc *DomainConfig) FixLegacyDC()
FixLegacyDC calls .FixUp() on all records within DC.
func (*DomainConfig) GetChangeCount ¶
func (dc *DomainConfig) GetChangeCount(providerName string) int
GetChangeCount accumulates change count in a thread-safe way.
func (*DomainConfig) GetCorrections ¶
func (dc *DomainConfig) GetCorrections(providerName string) []*Correction
GetCorrections returns the accumulated corrections for providerName.
func (*DomainConfig) GetPopulateCorrections ¶
func (dc *DomainConfig) GetPopulateCorrections(providerName string) []*Correction
GetPopulateCorrections returns zone corrections in a thread-safe way.
func (*DomainConfig) GetSplitHorizonNames ¶
func (dc *DomainConfig) GetSplitHorizonNames() (name, uniquename, tag string)
GetSplitHorizonNames returns the domain's name, uniquename, and tag. Deprecated: use .Name, .Uniquename, and .Tag directly instead.
func (*DomainConfig) GetUniqueName ¶
func (dc *DomainConfig) GetUniqueName() (uniquename string)
GetUniqueName returns the domain's uniquename. Deprecated: dc.UniqueName directly instead.
func (*DomainConfig) IncrementChangeCount ¶
func (dc *DomainConfig) IncrementChangeCount(providerName string, delta int)
IncrementChangeCount accumulates change count in a thread-safe way.
func (*DomainConfig) LabelFromDnsconfigjs ¶
func (dc *DomainConfig) LabelFromDnsconfigjs(rawLabel, subdomainASCII string) (string, error)
LabelFromDnsconfigjs is like LabelFromDnsconfigjs but additionally applies D_EXTEND() subdomain label rewriting (mirroring the legacy recordBuilder logic in pkg/js/helpers.js). All string manipulation is done on post-IDNA (ASCII) strings, then any concatenation is performed. The returned label is relative to the zone (dc.Name).
subdomainASCII must already be in IDNA (punycode, lowercase) form; the caller converts and memoizes it (see DNSConfig.ImportRawRecords), since the same subdomain is shared by every record in a D_EXTEND block. If subdomainASCII is empty, this is equivalent to LabelFromDnsconfigjs.
func (*DomainConfig) LabelFromFQDNNoDot ¶
func (dc *DomainConfig) LabelFromFQDNNoDot(name string) string
LabelFromFQDNNoDot takes a label and prepares it for use in a RecordConfig. Name is a FQDN without a dot ("foo.example.com"). Name is assumed to be ASCII, not Unicode (which is what most APIs return). Name is assumed to end with the zone name (which is what most APIs return).
func (*DomainConfig) LabelFromFQDNWithDot ¶
func (dc *DomainConfig) LabelFromFQDNWithDot(name string) string
LabelFromFQDNWithDot takes a label and prepares it for use in a RecordConfig. Name is a FQDN with a dot ("foo.example.com."). Name is assumed to be ASCII, not Unicode (which is what most APIs return). Name is assumed to end with the zone name (which is what most APIs return).
func (*DomainConfig) LabelFromShort ¶
func (dc *DomainConfig) LabelFromShort(name string) string
LabelFromShort takes a label and prepares it for use in a RecordConfig. name is a "shortname" ("foo", not "foo.example.com"). name is assumed to be ASCII, not Unicode (which is what most APIs return). If name == "", "@" is returned.
func (*DomainConfig) MustNewRecordConfig ¶
func (dc *DomainConfig) MustNewRecordConfig(name string, ttl uint32, typeAny any, args ...any) *RecordConfig
MustNewRecordConfig is like models.NewRecordConfig but panics if initialization fails. It is intended for use in variable initializations in unit tests. Before using this, consider using models.AddTestRC() first.
func (*DomainConfig) MustNewRecordConfigParse ¶
func (dc *DomainConfig) MustNewRecordConfigParse(name string, ttl uint32, typeAny any, data string) *RecordConfig
MustNewRecordConfigParse is like NewRecordConfigParse but panics if initialization fails. It is intended for use in variable initializations in unit tests. Before using this, consider using models.AddTestRCParse() first.
func (*DomainConfig) NewRecordConfig ¶
func (dc *DomainConfig) NewRecordConfig(name string, ttl uint32, typeAny any, args ...any) (*RecordConfig, error)
NewRecordConfig constructs a models.NewRecord().
It may seem odd that this is a method of DomainConfig but it makes sense if you consider that a RecordConfig lives in the context of its DomainConfig. For example, the need to shorten a FQDN requires knowing the domain's name, which is stored in a DomainConfig. If you need to create a RecordConfig outside of a DomainConfig, consider using models.MakeTestRC() or models.MakeTestRCParse() (both in record_helpers_test.go). Behavior can be modified by sending an optional nrc.Flag struct as the last arg.
func (*DomainConfig) NewRecordConfigForRRv2toRC ¶
func (dc *DomainConfig) NewRecordConfigForRRv2toRC(name string, ttl uint32, typeNum uint16, rd dnsv2.RDATA) (*RecordConfig, error)
NewRecordConfigForRRv2toRC is like NewRecordConfig but takes an RDATA. It should only be used by RRv2toRC. It is not intended for general use.
func (*DomainConfig) NewRecordConfigParse ¶
func (dc *DomainConfig) NewRecordConfigParse(name string, ttl uint32, typeAny any, data string, rcflag ...nrc.Flags) (*RecordConfig, error)
NewRecordConfigParse is like NewRecordConfig but the fields of the record come from parsing data which is assumed to be in RFC1038 Zonefile format. Behavior can be modified by sending an optional rfc.Flag struct.
func (*DomainConfig) PopulateNamesFromRaw ¶
func (dc *DomainConfig) PopulateNamesFromRaw(rawname string)
func (*DomainConfig) PostProcess ¶
func (dc *DomainConfig) PostProcess()
PostProcess performs and post-processing required after running dnsconfig.js and loading the result. It is called by dns.go's PostProcess() function.
func (*DomainConfig) Punycode ¶
func (dc *DomainConfig) Punycode() error
Punycode will convert all records to punycode format. It will encode: - Name - NameFQDN - Target (CNAME and MX only). NOTE: This will go away when RCv3 is adopted.
func (*DomainConfig) StoreCorrections ¶
func (dc *DomainConfig) StoreCorrections(providerName string, corrections []*Correction)
StoreCorrections accumulates corrections in a thread-safe way.
func (*DomainConfig) StorePopulateCorrections ¶
func (dc *DomainConfig) StorePopulateCorrections(providerName string, corrections []*Correction)
StorePopulateCorrections accumulates corrections in a thread-safe way.
func (*DomainConfig) ToFqdnNoDot ¶
func (dc *DomainConfig) ToFqdnNoDot(s string) string
ToFqdnNoDot is the same as ToFqdnWithDot but the result does not include a trailing ".". Replaces dnsutilv1.AddOrigin(). Similar to DomainConfig.ToFqdnNoDot() but it takes origin from dc.Name.
func (*DomainConfig) ToFqdnWithDot ¶
func (dc *DomainConfig) ToFqdnWithDot(s string) string
ToFqdnWithDot converts a shortname to a FQDN+".". (Assume dc.Name == "bar.com") ToFqdnWithDot("foo") = "foo.bar.com." // Typical use. ToFqdnWithDot("@") = "bar.com." // Apex returns the apex. ToFqdnWithDot("") = "bar.com." // Apex returns the apex. ToFqdnWithDot("foo.com.") = "foo.com." // FQDNs are unmodified. ToFqdnWithDot("foo"") = "foo.bar.com." // If origin ends with a ".", DTRT. Replaces dnsutilv1.AddOrigin(). Similar to nameutil.ToFqdnWithDot() but uses the domain name from dc.
func (*DomainConfig) ToShort ¶
func (dc *DomainConfig) ToShort(name string) string
ToShort returns the shortname by stripping the domain's name from "name". If name is not below dc.Name, name is returned unchanged. If the name was shortened, it does not end with a ".". If the name was untouched, it ends with a ".". Calling ToShort on a string that is already a shortname is unsupported. Names that do not end with "." are assumed to be FQDNs without a trailing ".". Similar to name.ToShort() but uses the domain name from dc.
type Nameserver ¶
type Nameserver struct {
Name string `json:"name"` // Normalized to a FQDN with NO trailing "."
}
Nameserver describes a nameserver.
func ToNameservers ¶
func ToNameservers(nss []string) ([]*Nameserver, error)
ToNameservers turns a list of strings into a list of Nameservers. It is an error if any string has a trailing dot. Either remove the trailing dot before you call this or (much preferred) use ToNameserversStripTD.
func ToNameserversStripTD ¶
func ToNameserversStripTD(nss []string) ([]*Nameserver, error)
ToNameserversStripTD is like ToNameservers but strips the trailing dot from each item. It is an error if there is no trailing dot.
func (*Nameserver) String ¶
func (n *Nameserver) String() string
type ProviderBase ¶
ProviderBase describes providers.
type RawRecordConfig ¶
type RawRecordConfig struct {
Type string `json:"type"`
Args []any `json:"args,omitempty"`
Metas []map[string]any `json:"metas,omitempty"`
TTL uint32 `json:"ttl,omitempty"`
FilePos string `json:"filepos"` // Where in the file this record was defined.
// SubDomain (if non-empty) is the D_EXTEND() subdomain this record was
// declared under. It is used to rewrite the label and is stored in the
// resulting RecordConfig.SubDomain. See ImportRawRecords.
SubDomain string `json:"subdomain,omitempty"`
}
RawRecordConfig stores the user-input from dnsconfig.js for a DNS Record. This is later processed (in Go) to become a RecordConfig. NOTE: Only newer rtypes are processed this way. Eventually the legacy types will be converted.
type RecordBuilderFn ¶
type RecordConfig ¶
type RecordConfig struct {
// Type is the DNS record type (rtype), all caps, "A", "MX", etc. (Deprecated. Use .TypeNum)
Type string `json:"type"`
// TypeNum is the assigned number of the record's type. 1 for A, 5 for CNAME, etc. See dnsv2.TypeToString and dnsv2.StringToType.
// NB(tlim): Not currently used. Placeholder for future feature.
TypeNum uint16 `json:"typenum,omitempty"`
// ComparableV3 is an opaque string that can be used to compare two
// RecordConfigs for equality. Typically this is the Zonefile line
// minus the label and TTL.
// The V3 distingues itself from .Comparable, which it will eventually replace.
// NB(tlim): Not currently used. Placeholder for future feature.
ComparableV3 string `json:"comparablev3,omitempty"`
// TTL is the DNS record's TTL in seconds. 0 means provider default.
TTL uint32 `json:"ttl,omitempty"`
// Name is the shortname i.e. the FQDN without the parent domains's suffix.
// It should never be "". Record at the apex (naked domain) are represented by "@".
//NameRaw string `json:"name_raw,omitempty"` // .Name as the user entered it in dnsconfig.js
Name string `json:"name"` // The short name, PunyCode. See above.
NameUnicode string `json:"name_unicode,omitempty"` // .Name as Unicode (downcased, then convertedot Unicode).
// This is the FQDN version of .Name. It should never have a trailing ".".
//NameFQDNRaw string `json:"-"` // .NameFQDN as the user entered it in dnsconfig.js (downcased).
NameFQDN string `json:"-"` // Must end with ".$origin".
NameFQDNUnicode string `json:"-"` // .NameFQDN as Unicode (downcased, then convertedot Unicode).
// Metadata (desired) added to the record via dnsconfig.js. For example: A("foo", "1.2.3.4", {metakey: "value"})
Metadata map[string]string `json:"meta,omitempty"`
// FilePos (desired) is "filename:line:char" of the record in dnsconfig.js (desired).
FilePos string `json:"filepos"`
// Subdomain (if non-empty) contains the subdomain path for this record.
// When .Name* fields are updated to include the subdomain, this field is
// cleared.
SubDomain string `json:"subdomain,omitempty"`
// Original is a pointer to the provider-specific record object. When
// getting the records via the API, we store the original object here.
// Later if we need to pull out an ID or other provider-specific field, we
// can. Typically deleting or updating a record requires knowing its ID.
Original any `json:"-"`
MxPreference uint16 `json:"mxpreference,omitempty"`
SrvPriority uint16 `json:"srvpriority,omitempty"`
SrvWeight uint16 `json:"srvweight,omitempty"`
SrvPort uint16 `json:"srvport,omitempty"`
CaaTag string `json:"caatag,omitempty"`
CaaFlag uint8 `json:"caaflag,omitempty"`
DsKeyTag uint16 `json:"dskeytag,omitempty"`
DsAlgorithm uint8 `json:"dsalgorithm,omitempty"`
DsDigestType uint8 `json:"dsdigesttype,omitempty"`
DsDigest string `json:"dsdigest,omitempty"`
// DnskeyProtocol uint8 `json:"dnskeyprotocol,omitempty"`
// DnskeyAlgorithm uint8 `json:"dnskeyalgorithm,omitempty"`
// DnskeyPublicKey string `json:"dnskeypublickey,omitempty"`
// LocVersion uint8 `json:"locversion,omitempty"`
// LocSize uint8 `json:"locsize,omitempty"`
// LocHorizPre uint8 `json:"lochorizpre,omitempty"`
// LocVertPre uint8 `json:"locvertpre,omitempty"`
// LocLatitude uint32 `json:"loclatitude,omitempty"`
// LocLongitude uint32 `json:"loclongitude,omitempty"`
// LocAltitude uint32 `json:"localtitude,omitempty"`
LuaRType string `json:"luartype,omitempty"`
NaptrOrder uint16 `json:"naptrorder,omitempty"`
NaptrPreference uint16 `json:"naptrpreference,omitempty"`
NaptrFlags string `json:"naptrflags,omitempty"`
NaptrService string `json:"naptrservice,omitempty"`
NaptrRegexp string `json:"naptrregexp,omitempty"`
// SmimeaUsage uint8 `json:"smimeausage,omitempty"`
// SmimeaSelector uint8 `json:"smimeaselector,omitempty"`
// SmimeaMatchingType uint8 `json:"smimeamatchingtype,omitempty"`
SshfpAlgorithm uint8 `json:"sshfpalgorithm,omitempty"`
SshfpFingerprint uint8 `json:"sshfpfingerprint,omitempty"`
SvcPriority uint16 `json:"svcpriority,omitempty"`
SvcParams string `json:"svcparams,omitempty"`
TlsaUsage uint8 `json:"tlsausage,omitempty"`
TlsaSelector uint8 `json:"tlsaselector,omitempty"`
TlsaMatchingType uint8 `json:"tlsamatchingtype,omitempty"`
R53Alias map[string]string `json:"r53_alias,omitempty"`
AzureAlias map[string]string `json:"azure_alias,omitempty"`
AnswerType string `json:"answer_type,omitempty"`
UnknownTypeName string `json:"unknown_type_name,omitempty"`
// contains filtered or unexported fields
}
RecordConfig stores a DNS record whether it was created from data downloaded from a provider's API ("actual") or from user input in dndsconfig.js ("desired").
func NewRecordConfigForRRtoRC ¶
func NewRecordConfigForRRtoRC(origin, name string, ttl uint32, typeNum uint16, args ...any) (*RecordConfig, error)
NewRecordConfigForRRtoRC is only for use by dnsrr.go. Do not use this. The signature may change at any time.
func (*RecordConfig) AsA ¶
func (rc *RecordConfig) AsA() dnsrdatav2.A
func (*RecordConfig) AsAAAA ¶
func (rc *RecordConfig) AsAAAA() dnsrdatav2.AAAA
func (*RecordConfig) AsADGUARDHOMEAAAAPASSTHROUGH ¶
func (rc *RecordConfig) AsADGUARDHOMEAAAAPASSTHROUGH() privatetypesrdata.ADGUARDHOMEAAAAPASSTHROUGH
func (*RecordConfig) AsADGUARDHOMEAPASSTHROUGH ¶
func (rc *RecordConfig) AsADGUARDHOMEAPASSTHROUGH() privatetypesrdata.ADGUARDHOMEAPASSTHROUGH
func (*RecordConfig) AsAFSDB ¶
func (rc *RecordConfig) AsAFSDB() dnsrdatav2.AFSDB
func (*RecordConfig) AsAKAMAICDN ¶
func (rc *RecordConfig) AsAKAMAICDN() privatetypesrdata.AKAMAICDN
func (*RecordConfig) AsAKAMAITLC ¶
func (rc *RecordConfig) AsAKAMAITLC() privatetypesrdata.AKAMAITLC
func (*RecordConfig) AsALIAS ¶
func (rc *RecordConfig) AsALIAS() privatetypesrdata.ALIAS
func (*RecordConfig) AsAVC ¶
func (rc *RecordConfig) AsAVC() dnsrdatav2.TXT
func (*RecordConfig) AsAZUREALIAS ¶
func (rc *RecordConfig) AsAZUREALIAS() privatetypesrdata.AZUREALIAS
func (*RecordConfig) AsBUNNYDNSPZ ¶
func (rc *RecordConfig) AsBUNNYDNSPZ() privatetypesrdata.BUNNYDNSPZ
func (*RecordConfig) AsCAA ¶
func (rc *RecordConfig) AsCAA() dnsrdatav2.CAA
func (*RecordConfig) AsCDNSKEY ¶
func (rc *RecordConfig) AsCDNSKEY() dnsrdatav2.DNSKEY
func (*RecordConfig) AsCDS ¶
func (rc *RecordConfig) AsCDS() dnsrdatav2.DS
func (*RecordConfig) AsCERT ¶
func (rc *RecordConfig) AsCERT() dnsrdatav2.CERT
func (*RecordConfig) AsCFWORKERROUTE ¶
func (rc *RecordConfig) AsCFWORKERROUTE() privatetypesrdata.CFWORKERROUTE
func (*RecordConfig) AsCLA ¶
func (rc *RecordConfig) AsCLA() dnsrdatav2.TXT
func (*RecordConfig) AsCLOUDFLAREAPISINGLEREDIRECT ¶
func (rc *RecordConfig) AsCLOUDFLAREAPISINGLEREDIRECT() privatetypesrdata.CLOUDFLAREAPISINGLEREDIRECT
func (*RecordConfig) AsCLOUDNSWR ¶
func (rc *RecordConfig) AsCLOUDNSWR() privatetypesrdata.CLOUDNSWR
func (*RecordConfig) AsCNAME ¶
func (rc *RecordConfig) AsCNAME() dnsrdatav2.CNAME
func (*RecordConfig) AsCSYNC ¶
func (rc *RecordConfig) AsCSYNC() dnsrdatav2.CSYNC
func (*RecordConfig) AsDELEG ¶
func (rc *RecordConfig) AsDELEG() dnsrdatav2.DELEG
func (*RecordConfig) AsDELEGPARAM ¶
func (rc *RecordConfig) AsDELEGPARAM() dnsrdatav2.DELEG
func (*RecordConfig) AsDHCID ¶
func (rc *RecordConfig) AsDHCID() dnsrdatav2.DHCID
func (*RecordConfig) AsDLV ¶
func (rc *RecordConfig) AsDLV() dnsrdatav2.DS
func (*RecordConfig) AsDNAME ¶
func (rc *RecordConfig) AsDNAME() dnsrdatav2.DNAME
func (*RecordConfig) AsDNSKEY ¶
func (rc *RecordConfig) AsDNSKEY() dnsrdatav2.DNSKEY
func (*RecordConfig) AsDS ¶
func (rc *RecordConfig) AsDS() dnsrdatav2.DS
func (*RecordConfig) AsDSYNC ¶
func (rc *RecordConfig) AsDSYNC() dnsrdatav2.DSYNC
func (*RecordConfig) AsEID ¶
func (rc *RecordConfig) AsEID() dnsrdatav2.EID
func (*RecordConfig) AsEUI48 ¶
func (rc *RecordConfig) AsEUI48() dnsrdatav2.EUI48
func (*RecordConfig) AsEUI64 ¶
func (rc *RecordConfig) AsEUI64() dnsrdatav2.EUI64
func (*RecordConfig) AsFRAME ¶
func (rc *RecordConfig) AsFRAME() privatetypesrdata.FRAME
func (*RecordConfig) AsGID ¶
func (rc *RecordConfig) AsGID() dnsrdatav2.GID
func (*RecordConfig) AsGPOS ¶
func (rc *RecordConfig) AsGPOS() dnsrdatav2.GPOS
func (*RecordConfig) AsHINFO ¶
func (rc *RecordConfig) AsHINFO() dnsrdatav2.HINFO
func (*RecordConfig) AsHIP ¶
func (rc *RecordConfig) AsHIP() dnsrdatav2.HIP
func (*RecordConfig) AsHTTPS ¶
func (rc *RecordConfig) AsHTTPS() dnsrdatav2.SVCB
func (*RecordConfig) AsIPN ¶
func (rc *RecordConfig) AsIPN() dnsrdatav2.IPN
func (*RecordConfig) AsISDN ¶
func (rc *RecordConfig) AsISDN() dnsrdatav2.ISDN
func (*RecordConfig) AsKEY ¶
func (rc *RecordConfig) AsKEY() dnsrdatav2.DNSKEY
func (*RecordConfig) AsKX ¶
func (rc *RecordConfig) AsKX() dnsrdatav2.KX
func (*RecordConfig) AsL32 ¶
func (rc *RecordConfig) AsL32() dnsrdatav2.L32
func (*RecordConfig) AsL64 ¶
func (rc *RecordConfig) AsL64() dnsrdatav2.L64
func (*RecordConfig) AsLOC ¶
func (rc *RecordConfig) AsLOC() dnsrdatav2.LOC
func (*RecordConfig) AsLP ¶
func (rc *RecordConfig) AsLP() dnsrdatav2.LP
func (*RecordConfig) AsLUA ¶
func (rc *RecordConfig) AsLUA() privatetypesrdata.LUA
func (*RecordConfig) AsMB ¶
func (rc *RecordConfig) AsMB() dnsrdatav2.MB
func (*RecordConfig) AsMD ¶
func (rc *RecordConfig) AsMD() dnsrdatav2.MD
func (*RecordConfig) AsMF ¶
func (rc *RecordConfig) AsMF() dnsrdatav2.MF
func (*RecordConfig) AsMG ¶
func (rc *RecordConfig) AsMG() dnsrdatav2.MG
func (*RecordConfig) AsMIKROTIKFORWARDER ¶
func (rc *RecordConfig) AsMIKROTIKFORWARDER() privatetypesrdata.MIKROTIKFORWARDER
func (*RecordConfig) AsMIKROTIKFWD ¶
func (rc *RecordConfig) AsMIKROTIKFWD() privatetypesrdata.MIKROTIKFWD
func (*RecordConfig) AsMINFO ¶
func (rc *RecordConfig) AsMINFO() dnsrdatav2.MINFO
func (*RecordConfig) AsMR ¶
func (rc *RecordConfig) AsMR() dnsrdatav2.MR
func (*RecordConfig) AsMX ¶
func (rc *RecordConfig) AsMX() dnsrdatav2.MX
func (*RecordConfig) AsNAPTR ¶
func (rc *RecordConfig) AsNAPTR() dnsrdatav2.NAPTR
func (*RecordConfig) AsNID ¶
func (rc *RecordConfig) AsNID() dnsrdatav2.NID
func (*RecordConfig) AsNIMLOC ¶
func (rc *RecordConfig) AsNIMLOC() dnsrdatav2.NIMLOC
func (*RecordConfig) AsNINFO ¶
func (rc *RecordConfig) AsNINFO() dnsrdatav2.NINFO
func (*RecordConfig) AsNS ¶
func (rc *RecordConfig) AsNS() dnsrdatav2.NS
func (*RecordConfig) AsNSAPPTR ¶
func (rc *RecordConfig) AsNSAPPTR() dnsrdatav2.NSAPPTR
func (*RecordConfig) AsNSEC ¶
func (rc *RecordConfig) AsNSEC() dnsrdatav2.NSEC
func (*RecordConfig) AsNSEC3 ¶
func (rc *RecordConfig) AsNSEC3() dnsrdatav2.NSEC3
func (*RecordConfig) AsNSEC3PARAM ¶
func (rc *RecordConfig) AsNSEC3PARAM() dnsrdatav2.NSEC3PARAM
func (*RecordConfig) AsNULL ¶
func (rc *RecordConfig) AsNULL() dnsrdatav2.NULL
func (*RecordConfig) AsNXT ¶
func (rc *RecordConfig) AsNXT() dnsrdatav2.NSEC
func (*RecordConfig) AsOPENPGPKEY ¶
func (rc *RecordConfig) AsOPENPGPKEY() dnsrdatav2.OPENPGPKEY
func (*RecordConfig) AsPORKBUNURLFWD ¶
func (rc *RecordConfig) AsPORKBUNURLFWD() privatetypesrdata.PORKBUNURLFWD
func (*RecordConfig) AsPTR ¶
func (rc *RecordConfig) AsPTR() dnsrdatav2.PTR
func (*RecordConfig) AsPX ¶
func (rc *RecordConfig) AsPX() dnsrdatav2.PX
func (*RecordConfig) AsR53ALIAS ¶
func (rc *RecordConfig) AsR53ALIAS() privatetypesrdata.R53ALIAS
func (*RecordConfig) AsRESINFO ¶
func (rc *RecordConfig) AsRESINFO() dnsrdatav2.TXT
func (*RecordConfig) AsRKEY ¶
func (rc *RecordConfig) AsRKEY() dnsrdatav2.RKEY
func (*RecordConfig) AsRP ¶
func (rc *RecordConfig) AsRP() dnsrdatav2.RP
func (*RecordConfig) AsRRSIG ¶
func (rc *RecordConfig) AsRRSIG() dnsrdatav2.RRSIG
func (*RecordConfig) AsRT ¶
func (rc *RecordConfig) AsRT() dnsrdatav2.RT
func (*RecordConfig) AsSIG ¶
func (rc *RecordConfig) AsSIG() dnsrdatav2.RRSIG
func (*RecordConfig) AsSMIMEA ¶
func (rc *RecordConfig) AsSMIMEA() dnsrdatav2.SMIMEA
func (*RecordConfig) AsSOA ¶
func (rc *RecordConfig) AsSOA() dnsrdatav2.SOA
func (*RecordConfig) AsSPF ¶
func (rc *RecordConfig) AsSPF() dnsrdatav2.TXT
func (*RecordConfig) AsSRV ¶
func (rc *RecordConfig) AsSRV() dnsrdatav2.SRV
func (*RecordConfig) AsSSHFP ¶
func (rc *RecordConfig) AsSSHFP() dnsrdatav2.SSHFP
func (*RecordConfig) AsSVCB ¶
func (rc *RecordConfig) AsSVCB() dnsrdatav2.SVCB
func (*RecordConfig) AsTA ¶
func (rc *RecordConfig) AsTA() dnsrdatav2.TA
func (*RecordConfig) AsTALINK ¶
func (rc *RecordConfig) AsTALINK() dnsrdatav2.TALINK
func (*RecordConfig) AsTKEY ¶
func (rc *RecordConfig) AsTKEY() dnsrdatav2.TKEY
func (*RecordConfig) AsTLSA ¶
func (rc *RecordConfig) AsTLSA() dnsrdatav2.TLSA
func (*RecordConfig) AsTSIG ¶
func (rc *RecordConfig) AsTSIG() dnsrdatav2.TSIG
func (*RecordConfig) AsTXT ¶
func (rc *RecordConfig) AsTXT() dnsrdatav2.TXT
func (*RecordConfig) AsUID ¶
func (rc *RecordConfig) AsUID() dnsrdatav2.UID
func (*RecordConfig) AsUINFO ¶
func (rc *RecordConfig) AsUINFO() dnsrdatav2.UINFO
func (*RecordConfig) AsURI ¶
func (rc *RecordConfig) AsURI() dnsrdatav2.URI
func (*RecordConfig) AsURL ¶
func (rc *RecordConfig) AsURL() privatetypesrdata.URL
func (*RecordConfig) AsURL301 ¶
func (rc *RecordConfig) AsURL301() privatetypesrdata.URL301
func (*RecordConfig) AsWALLET ¶
func (rc *RecordConfig) AsWALLET() dnsrdatav2.TXT
func (*RecordConfig) AsX25 ¶
func (rc *RecordConfig) AsX25() dnsrdatav2.X25
func (*RecordConfig) AsZONEMD ¶
func (rc *RecordConfig) AsZONEMD() dnsrdatav2.ZONEMD
func (*RecordConfig) ChangeType ¶
func (rc *RecordConfig) ChangeType(newType string, _ string)
ChangeType converts rc to an rc of type newType. This is only needed when converting from one type to another. Do not use this when initializing a new record.
Typically this is used to convert an ALIAS to a CNAME, or SPF to TXT. Using this function future-proofs the code since eventually such changes will require extra steps.
func (*RecordConfig) ClearRDATA ¶
func (rc *RecordConfig) ClearRDATA()
ClearRDATA sets rc.rdata to nil. This is a workaround and will eventually be eliminated.
func (*RecordConfig) Copy ¶
func (rc *RecordConfig) Copy() (*RecordConfig, error)
Copy returns a deep copy of a RecordConfig.
func (*RecordConfig) FixRD ¶
func (rc *RecordConfig) FixRD(origin string)
FixRD populates the "V3 Fields": .TypeNum, .RDATA and .ComparableV3. It is non-destructive for .RDATA and .ComparableV3 if those are non-nil.
func (*RecordConfig) GetDependencies ¶
func (rc *RecordConfig) GetDependencies() []string
GetDependencies returns the FQDNs on which this record dependents.
func (*RecordConfig) GetLabel ¶
func (rc *RecordConfig) GetLabel() string
GetLabel returns the shortname of the label associated with this RecordConfig. It will never end with ".". It does not need further shortening (i.e. if it returns "foo.com" and the domain is "foo.com" then the FQDN is actually "foo.com.foo.com"). It will never be "" (the apex is returned as "@").
func (*RecordConfig) GetLabelFQDN ¶
func (rc *RecordConfig) GetLabelFQDN() string
GetLabelFQDN returns the FQDN of the label associated with this RecordConfig. It will not end with ".".
func (*RecordConfig) GetRDATA ¶
func (rc *RecordConfig) GetRDATA() (rd dnsv2.RDATA)
GetRDATA is a getter for RecordConfig.rdata.
func (*RecordConfig) GetTargetCombined ¶
func (rc *RecordConfig) GetTargetCombined() string
GetTargetCombined returns a string with the various fields combined. For example, an MX record might output `10 mx10.example.tld`.
func (*RecordConfig) GetTargetCombinedFunc ¶
func (rc *RecordConfig) GetTargetCombinedFunc(encodeFn func(s string) string) string
GetTargetCombinedFunc returns all the rdata fields of a RecordConfig as one string. How TXT records are encoded is defined by encodeFn. If encodeFn is nil the TXT data is returned unaltered.
func (*RecordConfig) GetTargetDebug ¶
func (rc *RecordConfig) GetTargetDebug() string
GetTargetDebug returns a string with the various fields spelled out.
func (*RecordConfig) GetTargetField ¶
func (rc *RecordConfig) GetTargetField() string
GetTargetField returns the target. There may be other fields, but they are not included. For example, the .MxPreference field of an MX record isn't included.
func (*RecordConfig) GetTargetIP ¶
func (rc *RecordConfig) GetTargetIP() netip.Addr
GetTargetIP returns the net.IP stored in .target.
func (*RecordConfig) GetTargetJS ¶
func (rc *RecordConfig) GetTargetJS() string
GetTargetJS returns the target as a JavaScript literal, as documented in documentation/language-reference/domain-modifiers/*.md. Each parameter is quoted, unless it is an integer or boolean. We can't use GetTargetCombined() because it is not designed for JavaScript and may include unquoted parameters, which would break the JavaScript. Instead, we must quote each parameter separately. This doesn't support all types and needs to be improved. FIXME(tlim): This duplicates code in commands/getZones.go:formatDsl().
We should extract the common logic into a function they can both use.
func (*RecordConfig) GetTargetTXTJoined ¶
func (rc *RecordConfig) GetTargetTXTJoined() string
GetTargetTXTJoined returns the TXT target as one string.
func (*RecordConfig) GetTargetTXTSegmentCount ¶
func (rc *RecordConfig) GetTargetTXTSegmentCount() int
GetTargetTXTSegmentCount returns the number of 255-octet segments required to store TXT target.
func (*RecordConfig) GetTargetTXTSegmented ¶
func (rc *RecordConfig) GetTargetTXTSegmented() []string
GetTargetTXTSegmented returns the TXT target as 255-octet segments, with the remainder in the last segment.
func (*RecordConfig) HasFormatIdenticalToTXT ¶
func (rc *RecordConfig) HasFormatIdenticalToTXT() bool
HasFormatIdenticalToTXT returns if a RecordConfig has a format which is identical to TXT, such as SPF. For more details, read https://tools.ietf.org/html/rfc4408#section-3.1.1
func (*RecordConfig) IsTTLSignificant ¶
func (rc *RecordConfig) IsTTLSignificant() bool
func (*RecordConfig) Key ¶
func (rc *RecordConfig) Key() RecordKey
Key converts a RecordConfig into a RecordKey.
func (*RecordConfig) LineString ¶
func (rc *RecordConfig) LineString() string
LineString returns the text representation of the resource record, including the label, ttl, type, and fields. This may change some day to include metadata and other fields, skip zero TTLs, and more.
func (*RecordConfig) MarshalJSON ¶
func (rc *RecordConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals RecordConfig.
func (*RecordConfig) MustSetTarget ¶
func (rc *RecordConfig) MustSetTarget(target string)
MustSetTarget is like SetTarget, but panics if an error occurs. It should only be used in _test.go files and in the init() function.
func (*RecordConfig) RecomputeV3Fields ¶
func (rc *RecordConfig) RecomputeV3Fields(origin string)
RecomputeV3Fields re-derives the cached "V3 Fields" (.RDATA and .ComparableV3) after a record's underlying fields have been mutated after the record was first constructed (for example, a provider filling in a default value such as an R53_ALIAS zone_id). FixUp only populates these fields when they are empty, so they must be cleared first; otherwise the diff engine (which compares .ComparableV3) would keep seeing the pre-mutation values and report a spurious change.
func (*RecordConfig) RegenerateComparableV3 ¶
func (rc *RecordConfig) RegenerateComparableV3()
RegenerateComparableV3 generates or regenerates the .ComparableV3 field from the current .RDATA. It does not modify .RDATA.
func (*RecordConfig) SetLabel ¶
func (rc *RecordConfig) SetLabel(short, origin string)
SetLabel sets the .Name/.NameFQDN fields given a short name and origin. origin must not have a trailing dot: The entire code base maintains dc.Name without the trailig dot. Finding a dot here means something is very wrong.
short must not have a training dot: That would mean you have a FQDN, and shouldn't be using SetLabel(). Maybe SetLabelFromFQDN()?
func (*RecordConfig) SetLabelFromFQDN ¶
func (rc *RecordConfig) SetLabelFromFQDN(fqdn, origin string)
SetLabelFromFQDN sets the .Name/.NameFQDN fields given a FQDN and origin. fqdn may have a trailing "." but it is not required. origin may not have a trailing dot. This is legacy code that will go away when everything uses models.NewRecordConfig*() functions.
func (*RecordConfig) SetRDATA ¶
func (rc *RecordConfig) SetRDATA(rd dnsv2.RDATA)
SetRDATA is a setter for RecordConfig.rdata.
func (*RecordConfig) SetTarget ¶
func (rc *RecordConfig) SetTarget(target string) error
SetTarget sets the target, assuming that the rtype is appropriate.
func (*RecordConfig) SetTargetIP ¶
func (rc *RecordConfig) SetTargetIP(ip netip.Addr) error
SetTargetIP sets the target to an IP, verifying this is an appropriate rtype.
func (*RecordConfig) SetTargetTXT ¶
func (rc *RecordConfig) SetTargetTXT(s string) error
SetTargetTXT sets the TXT fields when there is 1 string.
LUA records reuse the TXT accessors (their payload is a TXT-format string). When .Type is "LUA" the value is stored as a LUA rdata (using the already-set .LuaRType) rather than a TXT rdata.
func (*RecordConfig) SetTargetTXTs ¶
func (rc *RecordConfig) SetTargetTXTs(s []string) error
SetTargetTXTs joins the supplied TXT fields and stores canonical 255-octet segments.
func (*RecordConfig) ToComparableNoTTL ¶
func (rc *RecordConfig) ToComparableNoTTL() string
ToComparableNoTTL returns a comparison string. If you need to compare two RecordConfigs, you can simply compare the string returned by this function. The comparison includes all fields except TTL and any provider-specific metafields. Provider-specific metafields like CF_PROXY are not the same as pseudo-records like ANAME or R53_ALIAS.
func (*RecordConfig) ToRRv2 ¶
func (rc *RecordConfig) ToRRv2() dnsv2.RR
ToRRv2 converts a RecordConfig to a dnsv2.RR.
func (*RecordConfig) UnmarshalJSON ¶
func (rc *RecordConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals RecordConfig.
type RecordDB ¶
type RecordDB struct {
// contains filtered or unexported fields
}
RecordDB is a container of many RecordConfig, queryable by various methods. The first to be implemented is as a hash with label:type as the index.
func NewRecordDBFromRecords ¶
NewRecordDBFromRecords creates a RecordDB from a list of RecordConfig.
func (*RecordDB) ContainsLT ¶
func (recdb *RecordDB) ContainsLT(rec *RecordConfig) bool
ContainsLT returns true if recdb contains rec. Matching is done on the record's label and type (i.e. the RecordKey).
type Records ¶
type Records []*RecordConfig
Records is a list of *RecordConfig.
func BuilderLOC ¶
func (Records) FixLegacyRecords ¶
FixLegacyRecords calls .FixUp() on all records in recs.
func (Records) GetAllDependencies ¶
GetAllDependencies concatinates all dependencies of all records.
func (Records) GroupedByFQDN ¶
GroupedByFQDN returns a map of keys to records, grouped by FQDN.
func (Records) GroupedByKey ¶
GroupedByKey returns a map of keys to records.
func (Records) HasRecordTypeName ¶
HasRecordTypeName returns True if there is a record with this rtype and name.
func (Records) StringEach ¶
StringEach returns a list of strings, one for each RecordConfig in recs.
type Registrar ¶
type Registrar interface {
GetRegistrarCorrections(dc *DomainConfig) ([]*Correction, error)
}
Registrar is an interface for Registrar plug-ins.
type RegistrarConfig ¶
type RegistrarConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Metadata json.RawMessage `json:"meta,omitempty"`
}
RegistrarConfig describes a registrar.
type RegistrarInstance ¶
type RegistrarInstance struct {
ProviderBase
Driver Registrar
}
RegistrarInstance is a single registrar.
type UnmanagedConfig ¶
type UnmanagedConfig struct {
// Glob pattern for matching labels.
LabelPattern string `json:"label_pattern,omitempty"`
LabelGlob glob.Glob `json:"-"` // Compiled version
// Comma-separated list of DNS Resource Types.
RTypePattern string `json:"rType_pattern,omitempty"`
RTypeMap map[string]struct{} `json:"-"` // map of RTypes or len()=0 for all
// Glob pattern for matching targets.
TargetPattern string `json:"target_pattern,omitempty"`
TargetGlob glob.Glob `json:"-"` // Compiled version
}
UnmanagedConfig describes an IGNORE() rule. NB(tlim): This is called "Unmanaged" because the original design was to call this function UNMANAGED(). However we then realized that we could repurpose IGNORE() without any compatibility issues. NB(tlim): TechDebt: UnmanagedConfig and DebugUnmanagedConfig should be moved to pkg/diff2/handsoff.go and the following fields could be unexported: LabelGlob, RTypeMap, and TargetGlob
Source Files
¶
- addrecord.go
- b_loc.go
- builders.go
- dns.go
- dnsrr.go
- domain.go
- makers.go
- metadata.go
- populatelegacy.go
- populaterd.go
- provider.go
- rawrecord.go
- rawrecord_import.go
- rdata.go
- record.go
- record_astype.go
- record_factory.go
- record_label.go
- record_maketestdata.go
- recorddb.go
- recordtype.go
- stutter.go
- t_loc.go
- t_naptr.go
- t_svcb.go
- t_txt.go
- target.go
- tdwarn.go
- unknown.go
- unmanaged.go