model

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REC_A     = DNSRecordType("A")
	REC_AAAA  = DNSRecordType("AAAA")
	REC_CNAME = DNSRecordType("CNAME")
	REC_MX    = DNSRecordType("MX")
	REC_NS    = DNSRecordType("NS")
	REC_SOA   = DNSRecordType("SOA")
	REC_SRV   = DNSRecordType("SRV")
	REC_TXT   = DNSRecordType("TXT")
	REC_PTR   = DNSRecordType("PTR")
	REC_NAPTR = DNSRecordType("NAPTR")
	REC_DNAME = DNSRecordType("DNAME")
	REC_DS    = DNSRecordType("DS")
	REC_SSHFP = DNSRecordType("SSHFP")
	REC_TLSA  = DNSRecordType("TLSA")
	REC_SVCB  = DNSRecordType("SVCB")
	REC_HTTPS = DNSRecordType("HTTPS")
	REC_URI   = DNSRecordType("URI")
	REC_CAA   = DNSRecordType("CAA")
	REC_ANAME = DNSRecordType("ANAME")
	REC_FWD   = DNSRecordType("FWD")
	REC_APP   = DNSRecordType("APP")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSApiClient

type DNSApiClient interface {
	GetRecords(ctx context.Context, domain DNSRecordName) ([]DNSRecord, error)
	AddRecord(ctx context.Context, record DNSRecord) error
	UpdateRecord(ctx context.Context, oldRecord DNSRecord, newRecord DNSRecord) error
	DeleteRecord(ctx context.Context, record DNSRecord) error
}

client API interface

type DNSDomain

type DNSDomain string

type DNSRecord

type DNSRecord struct {
	Type   DNSRecordType // from the enum above
	Domain DNSRecordName // @ for top-level TXT/MX/A/NS...

	TTL DNSRecordTTL // min 600, def 3600

	Comments  string       // comment for the added resource
	ExpiryTTL DNSRecordTTL // automatically delete the record when the value in seconds elapses

	IPAddress       string // ip address, required for A or AAAA record
	Ptr             bool   // This option is used only for A and AAAA records.
	CreatePtrZone   bool   // This option is used for A and AAAA records.
	UpdateSvcbHints bool   // This option is used for A and AAAA records.

	NameServer string // This option is required for adding NS record.
	Glue       string // This optional parameter is used for adding NS record.

	CName string // This option is required for adding CNAME record.

	PtrName string // This option is required for adding PTR record.

	Exchange   string        // This option is required for adding MX record.
	Preference DNSRecordPrio // This option is required for adding MX record.

	Text      string //  This option is required for adding TXT record.
	SplitText bool   // Set to true for using new line char to split text into multiple character-strings for adding TXT record.

	Mailbox   string // for adding RP record.
	TxtDomain string // Set a TXT record's domain name for adding RP record.

	Priority DNSRecordPrio       // This parameter is required for adding the SRV record.
	Weight   DNSRecordSRVWeight  // This parameter is required for adding the SRV record.
	Port     DNSRecordSRVPort    // This parameter is required for adding the SRV record.
	Target   DNSRecordSRVService // This parameter is required for adding the SRV record.

	NaptrOrder       uint16 // This parameter is required for adding the NAPTR record.
	NaptrPreference  uint16 // This parameter is required for adding the NAPTR record.
	NaptrFlags       string // This parameter is required for adding the NAPTR record.
	NaptrServices    string // This parameter is required for adding the NAPTR record.
	NaptrRegexp      string // This parameter is required for adding the NAPTR record.
	NaptrReplacement string // This parameter is required for adding the NAPTR record.

	DName string // This parameter is required for adding DNAME record.

	KeyTag     uint16 // This parameter is required for adding DS record.
	Algorithm  string // This parameter is required for adding DS record.
	DigestType string // This parameter is required for adding DS record.
	Digest     string // This parameter is required for adding DS record.

	SshfpAlgorithm       string // This parameter is required for adding SSHFP record.
	SshfpFingerprintType string // This parameter is required for adding SSHFP record.
	SshfpFingerprint     string // This parameter is required for adding SSHFP record.

	TlsaCertificateUsage           string // This parameter is required for adding TLSA record.
	TlsaSelector                   string // This parameter is required for adding TLSA record.
	TlsaMatchingType               string // This parameter is required for adding TLSA record.
	TlsaCertificateAssociationData string // This parameter is required for adding TLSA record.

	SvcPriority   uint16 // This parameter is required for adding SCVB or HTTPS record.
	SvcTargetName string // This parameter is required for adding SCVB or HTTPS record.
	SvcParams     string // This parameter is required for adding SCVB or HTTPS record.

	AutoIpv4Hint bool // This parameter is optional for adding SCVB or HTTPS record.
	AutoIpv6Hint bool // This parameter is optional for adding SCVB or HTTPS record.

	UriPriority uint16 // This parameter is required for adding URI record.
	UriWeight   uint16 // This parameter is required for adding URI record.
	Uri         string // This parameter is required for adding URI record.

	Flags string // This parameter is required for adding the CAA record.
	Tag   string // This parameter is required for adding the CAA record.
	Value string // This parameter is required for adding the CAA record.

	AName string // This parameter is required for adding the ANAME record.

	Forwarder         string // This parameter is required for adding the FWD record.
	ForwarderPriority uint16 // This parameter is required for adding the FWD record.
	DnssecValidation  bool   // This parameter is optional for adding the FWD record.
	ProxyType         string // This parameter is optional for adding the FWD record.
	ProxyAddress      string // This parameter is optional for adding the FWD record.
	ProxyPort         uint16 // This parameter is optional for adding the FWD record.
	ProxyUsername     string // This parameter is optional for adding the FWD record.
	ProxyPassword     string // This parameter is optional for adding the FWD record.

	AppName    string //  This parameter is required for adding the APP record.
	ClassPath  string //  This parameter is required for adding the APP record.
	RecordData string //  This parameter is required for adding the APP record.
}

func (DNSRecord) SameKey

func (r DNSRecord) SameKey(r1 DNSRecord) bool

compare key field to determine if two records refer to the same object

  • for CNAME there could be only 1 RR with the same name, TTL is the only value
  • for A, TXT and NS there could be several (so need to match by data),
  • MX matches the same way, value is ttl + prio (in theory, MX 0 and MX 10 could point to the same host in "data", but lets think that it is a perversion and replace it with one record
  • and SRV same if Port and Target are matched

...

type DNSRecordData

type DNSRecordData string

type DNSRecordName

type DNSRecordName string

type DNSRecordPrio

type DNSRecordPrio uint16

type DNSRecordSRVPort

type DNSRecordSRVPort uint16

type DNSRecordSRVProto

type DNSRecordSRVProto string // _tcp or _udp

type DNSRecordSRVService

type DNSRecordSRVService string // _ldap

type DNSRecordSRVWeight

type DNSRecordSRVWeight uint16

type DNSRecordTTL

type DNSRecordTTL uint32 // formally int32, but [0, 604800]

type DNSRecordType

type DNSRecordType string

type DNSZone

type DNSZone string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL