Documentation
¶
Index ¶
- Constants
- func DecodeLuaPayload(payload string) (string, error)
- 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, _ 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 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 NameserversToStrings(nss []*Nameserver) (s []string)
- func ParseLuaContent(content string) (rtype string, payload string)
- func RDtoFields(s dnsv2.RDATA) ([]any, error)
- func RDtoFieldsJS(s dnsv2.RDATA) ([]string, error)
- func RDtoFieldsStrings(s dnsv2.RDATA) ([]string, error)
- 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 Dependency
- 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) 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) 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) AsBUNNYDNSRDR() privatetypesrdata.BUNNYDNSRDR
- 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) AsIMPORTTRANSFORM() privatetypesrdata.IMPORTTRANSFORM
- 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) ChangeTypeToCNAME(dc *DomainConfig, target string)
- func (rc *RecordConfig) ClearRDATA()
- func (rc *RecordConfig) Copy() (*RecordConfig, error)
- func (rc *RecordConfig) GetDependencies() []Dependency
- func (rc *RecordConfig) GetLabel() string
- func (rc *RecordConfig) GetLabelFQDN() string
- func (rc *RecordConfig) GetRDATA() (rd dnsv2.RDATA)
- func (rc *RecordConfig) GetTargetField() string
- func (rc *RecordConfig) GetTargetIP() netip.Addr
- 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) SetLabel(short, origin string)
- func (rc *RecordConfig) SetLabelFromFQDN(fqdn, origin string)
- func (rc *RecordConfig) SetRDATA(rd dnsv2.RDATA)
- 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) StringWithMeta() string
- func (rc *RecordConfig) ToRRv2() dnsv2.RR
- type RecordDB
- type RecordKey
- type Records
- 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 DecodeLuaPayload ¶
DecodeLuaPayload normalizes the LUA payload for storage in RecordConfig.target.
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 closer to where it is used.
func MakeDNSKEY ¶
func MakeMIKROTIKFWD ¶
func MakeMIKROTIKNXDOMAIN ¶
func MakeOPENPGPKEY ¶
func MakePORKBUNURLFWD ¶
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 RDtoFields ¶
RDtoFields extracts the exported fields from an RD into []any. Fileds prefixed with "RT_" are not included, as they are "Runtime" values, not part of the RD itself.
func RDtoFieldsJS ¶
RDtoFieldsJS returns the fields of a RDATA struct as Javascript-constants. Examples: int: `2`; string: `"mystring"` Floats are restricted to 2 digits after the decimal.
func RDtoFieldsStrings ¶
RDtoFieldsStrings returns the fields of a RDATA struct as strings. Floats are restricted to 2 digits after the decimal.
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. FIXME(tlim): Unexport.
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. FIXME(tlim): Unexport.
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 {
// AuditRecords validates records without initialization or credentials.
// It must neither depend on nor mutate receiver state.
AuditRecords(Records) []error
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
Metadata json.RawMessage // Effective configMetadata for this domain and credEntry.
}
DNSProviderInstance is a single DNS provider.
type Dependency ¶
Dependency is a record another record depends on. NameFQDN picks the label; OnlyType restricts to that record type there ("" = any). E.g. a CNAME depends on {NameFQDN: its *target*, OnlyType: ""}. E.g. a DS depends on the NS record at the same label: {NameFQDN: its *label*, OnlyType: "NS"}.
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"`
// DNSProviderMetadata contains domain-specific configMetadata, keyed by credEntry.
// An absent entry inherits metadata from the legacy NewDnsProvider declaration.
DNSProviderMetadata map[string]json.RawMessage `json:"dnsProviderMetadata,omitempty"`
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) 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 processes labels from `dnsconfig.js`.
nameRaw can be any string that is acceptable in dnsconfig.js, including "@", "foo", "foo.bar", "foo.bar.baz.", etc.
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.
It enforces the "single dot" rule.
It applies D_EXTEND() subdomain label rewriting.
The returned label is relative to the zone (dc.Name).
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. 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 nrc.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) 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 ".". 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. 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, the result never ends with a ".". If the name was untouched, it always 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 nameutil.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 {
// TypeNum is the assigned number of the record's type. 1 for A, 5 for CNAME, etc. See dnsv2.TypeToString and dnsv2.StringToType.
TypeNum uint16 `json:"typenum,omitempty"`
// Type is the DNS record type (rtype), all caps, "A", "MX", etc. (Deprecated. Use .TypeNum)
Type string `json:"type"`
// 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 "@".
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 ".".
NameFQDN string `json:"-"` // Must end with ".$origin".
NameFQDNUnicode string `json:"-"` // .NameFQDN as Unicode (downcased, then convertedot Unicode).
// 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"`
// 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.
// ProTip: Rather than storing the entire struct, store the specific field needed.
Original any `json:"-"`
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"). FYI: If you add a field to this struct, also add it to the list in the UnmarshalJSON function.
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) AsBUNNYDNSRDR ¶
func (rc *RecordConfig) AsBUNNYDNSRDR() privatetypesrdata.BUNNYDNSRDR
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) AsIMPORTTRANSFORM ¶
func (rc *RecordConfig) AsIMPORTTRANSFORM() privatetypesrdata.IMPORTTRANSFORM
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) ChangeTypeToCNAME ¶
func (rc *RecordConfig) ChangeTypeToCNAME(dc *DomainConfig, target string)
ChangeTypeToCNAME changes rc into a CNAME pointing at target. target will be passed to mustbe.TargetHost() to assure it is (or convert it to) a FQDN+".", canonicalized to ASCII, and ToLower.
func (*RecordConfig) ClearRDATA ¶
func (rc *RecordConfig) ClearRDATA()
ClearRDATA sets rc.rdata to nil. This is a workaround for integrationTest/helpers_integration_test.go and will eventually be eliminated. No new uses, please!
func (*RecordConfig) Copy ¶
func (rc *RecordConfig) Copy() (*RecordConfig, error)
Copy returns a deep copy of a RecordConfig.
func (*RecordConfig) GetDependencies ¶
func (rc *RecordConfig) GetDependencies() []Dependency
GetDependencies returns the records on which this record depends. For example, some providers won't create a CNAME until the target already exists. DNSControl will assure that the target exists before the CNAME is created if this function returns the target name when called on a CNAME record. The reverse is true for deletions: DNSControl will delete the records for rc.GetDependencies() before deleting the rc.
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) GetTargetField ¶
func (rc *RecordConfig) GetTargetField() string
GetTargetField returns the "target" field. That is, the field in RDATA that is a hostname. We hard-code certain types and others we guess by picking the last field in the struct. NOTE: Deprecated. No new code should use this. Get the field you need instead.
func (*RecordConfig) GetTargetIP ¶
func (rc *RecordConfig) GetTargetIP() netip.Addr
GetTargetIP returns the net.IP stored in .target. NOTE: Deprecated. No new code should use this. Use rc.AsA().Addr or rc.AsAAAA().Addr.
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) 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()? Deprecated: NewRecordConfig and NewRecordConfigParse remove the need for this.
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) SetTargetIP ¶
func (rc *RecordConfig) SetTargetIP(ip netip.Addr) error
SetTargetIP sets the target to an IP, verifying this is an appropriate rtype. NOTE: Deprecated. No new code should use this.
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", preserve its emitted record type while replacing the payload in its 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) StringWithMeta ¶
func (rc *RecordConfig) StringWithMeta() string
StringWithMeta returns LineString followed by sorted, quoted metadata.
func (*RecordConfig) ToRRv2 ¶
func (rc *RecordConfig) ToRRv2() dnsv2.RR
ToRRv2 converts a RecordConfig to a dnsv2.RR.
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 BuilderM365 ¶ added in v5.3.0
BuilderM365 implements M365_BUILDER(), which generates the DNS records Microsoft 365 requires for one domain. The records and the targets are taken from Microsoft's documentation: https://learn.microsoft.com/en-us/microsoft-365/enterprise/external-domain-name-system-records The pages for the individual records are listed under "References" in documentation/language-reference/domain-modifiers/M365_BUILDER.md.
args is [name, options]. The options object is moved from the metadata list into the argument list by m365Options() (pkg/js/helpers.js), so its values arrive as the JSON types dnsconfig.js produces: string, bool, float64 and map[string]any. Anything else is a user error, never a reason to panic.
Errors quote the call itself because builder errors are reported without a file position (see DNSConfig.ImportRawRecords).
func (Records) GetAllDependencies ¶
func (recs Records) GetAllDependencies() []Dependency
GetAllDependencies concatinates all dependencies of all records.
func (Records) GroupedByFQDN ¶
GroupedByFQDN returns a map of keys to records, grouped by FQDN.
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.Pattern `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.Pattern `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
- b_m365.go
- builders.go
- comparablev3.go
- dns.go
- dnsrr.go
- domain.go
- makers.go
- metadata.go
- provider.go
- rawrecord.go
- rawrecord_import.go
- rdata.go
- rdata_normalize.go
- rdfields.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_svcb.go
- t_txt.go
- target.go
- tdwarn.go
- unknown.go
- unmanaged.go