Documentation
¶
Index ¶
- Variables
- func FixLegacyDC(dc *models.DomainConfig)
- func FixLegacyRecord(rec *models.RecordConfig)
- func FixLegacyRecords(recs *models.Records)
- func ImportRawRecords(domains []*models.DomainConfig) error
- func NewRecordConfigFromRaw(opts FromRawOpts) (*models.RecordConfig, error)
- func NewRecordConfigFromString(name string, ttl uint32, t string, s string, ...) (*models.RecordConfig, error)
- func NewRecordConfigFromStruct(name string, ttl uint32, t string, fields any, ...) (*models.RecordConfig, error)
- func PaveArgs(args []any, argTypes string) error
- func Register(t RType)
- func StringifyQuoted(args []any) string
- type FromRawOpts
- type RType
Constants ¶
This section is empty.
Variables ¶
var Func map[string]RType = map[string]RType{}
Func is a map of registered rtypes.
Functions ¶
func FixLegacyDC ¶
func FixLegacyDC(dc *models.DomainConfig)
FixLegacyDC populates .F to compenstate for providers that have not been updated to support RecordConfigV2 when creating RecordConfig. It is called anywhere dc.PostProcess() or models.PostProcessRecords() is called. Those functions can't call it directly because that would cause an import cycle.
func FixLegacyRecord ¶
func FixLegacyRecord(rec *models.RecordConfig)
FixLegacyRecord populates .F to compenstate for providers that have not been updated to support RecordConfigV2 when creating RecordConfig.
func FixLegacyRecords ¶
FixLegacyRecords populates .F to compenstate for providers that have not been updated to support RecordConfigV2 when creating RecordConfig. It is called anywhere provider.GetZoneRecords() is called. GetZoneRecords() can't call it directly because that would involve modifying every provider. Instead, providers should be fixed to generate records properly.
func ImportRawRecords ¶
func ImportRawRecords(domains []*models.DomainConfig) error
ImportRawRecords imports the RawRecordConfigs into RecordConfigs.
func NewRecordConfigFromRaw ¶
func NewRecordConfigFromRaw(opts FromRawOpts) (*models.RecordConfig, error)
NewRecordConfigFromRaw creates a new RecordConfig from the raw ([]any) args, usually from the parsed dnsconfig.js file, but also useful when a provider returns the fields of a record as individual values.
func NewRecordConfigFromString ¶
func NewRecordConfigFromString(name string, ttl uint32, t string, s string, dcn *domaintags.DomainNameVarieties) (*models.RecordConfig, error)
NewRecordConfigFromString creates a new RecordConfig from a string in the format usually used in a zonefile but typically also used by providers returning the fields of a record as a string.
func NewRecordConfigFromStruct ¶
func NewRecordConfigFromStruct(name string, ttl uint32, t string, fields any, dcn *domaintags.DomainNameVarieties) (*models.RecordConfig, error)
NewRecordConfigFromStruct creates a new RecordConfig from a struct, typically a miekg/dns struct. It must be the exact struct type used by the FromStruct() method of the rtype package.
func PaveArgs ¶
PaveArgs converts each arg to its desired type, or returns an error if conversion fails or if the number of arguments is wrong. argTypes is a string where each rune specifies the desired type of the arg in the same position: 's': string (will convert other types to string using %v) 'b': uint8 (will convert strings, truncate floats, etc) 'w': uint16 (will convert strings, truncate floats, etc) FUTURE 'd': uint32 (will convert strings, truncate floats, etc) FUTURE 'q': uint64 (will convert strings, truncate floats, etc) FUTURE: Uppercase runes for signed types.
func Register ¶
func Register(t RType)
Register registers a new RType (Record Type) implementation. It can be used to register an RFC-defined type, a new custom type, or a "builder".
It panics if the type is already registered, to prevent accidental overwrites.
func StringifyQuoted ¶
StringifyQuoted returns a string with each argument quoted.
Types ¶
type FromRawOpts ¶
type FromRawOpts struct {
Type string // (required) Record type (e.g., "A", "CNAME")
TTL uint32 // Time to live
Args []any // (required) Arguments for the record
Metas []map[string]any // Metadata for the record
DCN *domaintags.DomainNameVarieties // Domain name varieties
FilePos string // Position in the file where this record was defined
}
FromRawOpts contains the options for creating a RecordConfig from raw data. Except Type and Args, all fields are optional.
type RType ¶
type RType interface {
// Returns the name of the rtype ("A", "MX", etc.)
Name() string
// RecordConfig factory. Updates a RecordConfig's fields based on args.
FromArgs(*domaintags.DomainNameVarieties, *models.RecordConfig, []any) error
FromStruct(*domaintags.DomainNameVarieties, *models.RecordConfig, string, any) error
CopyToLegacyFields(*models.RecordConfig)
CopyFromLegacyFields(*models.RecordConfig)
}
RType is an interface that defines the methods required for a DNS record type.