models

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = uint32(300)

Variables

This section is empty.

Functions

func InterfaceToIP

func InterfaceToIP(i interface{}) (net.IP, error)

func SplitCombinedMxValue added in v0.1.5

func SplitCombinedMxValue(s string) (preference uint16, target string, err error)

SplitCombinedMxValue splits a combined MX preference and target into separate entities, i.e. splitting "10 aspmx2.googlemail.com." into "10" and "aspmx2.googlemail.com.".

Types

type Correction

type Correction struct {
	F   func() error `json:"-"`
	Msg string
}

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"`
}

func (*DNSConfig) FindDomain

func (config *DNSConfig) FindDomain(query string) *DomainConfig

type DNSProviderConfig

type DNSProviderConfig struct {
	Name     string          `json:"name"`
	Type     string          `json:"type"`
	Metadata json.RawMessage `json:"meta,omitempty"`
}

type DomainConfig

type DomainConfig struct {
	Name         string            `json:"name"` // NO trailing "."
	Registrar    string            `json:"registrar"`
	DNSProviders map[string]int    `json:"dnsProviders"`
	Metadata     map[string]string `json:"meta,omitempty"`
	Records      []*RecordConfig   `json:"records"`
	Nameservers  []*Nameserver     `json:"nameservers,omitempty"`
	KeepUnknown  bool              `json:"keepunknown,omitempty"`
}

func (*DomainConfig) CombineMXs added in v0.1.5

func (dc *DomainConfig) CombineMXs()

CombineMXs will merge the priority into the target field for all mx records. Useful for providers that desire them as one field.

func (*DomainConfig) Copy

func (dc *DomainConfig) Copy() (*DomainConfig, error)

func (*DomainConfig) Filter added in v0.1.5

func (dc *DomainConfig) Filter(f func(r *RecordConfig) bool)

func (*DomainConfig) HasRecordTypeName

func (dc *DomainConfig) HasRecordTypeName(rtype, name string) bool

func (*DomainConfig) Punycode added in v0.1.5

func (dc *DomainConfig) Punycode() error

Punycode will convert all records to punycode format. It will encode: - Name - NameFQDN - Target (CNAME and MX only)

type Nameserver

type Nameserver struct {
	Name   string `json:"name"` // Normalized to a FQDN with NO trailing "."
	Target string `json:"target"`
}

func StringsToNameservers

func StringsToNameservers(nss []string) []*Nameserver

type RecordConfig

type RecordConfig struct {
	Type         string            `json:"type"`
	Name         string            `json:"name"`   // The short name. See below.
	Target       string            `json:"target"` // If a name, must end with "."
	TTL          uint32            `json:"ttl,omitempty"`
	Metadata     map[string]string `json:"meta,omitempty"`
	NameFQDN     string            `json:"-"`                      // Must end with ".$origin". See below.
	MxPreference uint16            `json:"mxpreference,omitempty"` // FIXME(tlim): Rename to MxPreference
	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"`

	CombinedTarget bool `json:"-"`

	Original interface{} `json:"-"` // Store pointer to provider-specific record object. Used in diffing.
}

RecordConfig stores a DNS record. Providers are responsible for validating or normalizing the data that goes into a RecordConfig. If you update Name, you have to update NameFQDN and vice-versa.

Name:

This is the shortname i.e. the NameFQDN without the origin suffix.
It should never have a trailing "."
It should never be null. It should store It "@", not the apex domain, not null, etc.
It shouldn't end with the domain origin. If the origin is "foo.com." then
   if Name == "foo.com" then that literally means "foo.com.foo.com." is
   the intended FQDN.

NameFQDN:

This is the FQDN version of Name.
It should never have a trailiing ".".

func (*RecordConfig) Content added in v0.1.5

func (r *RecordConfig) Content() string

Content combines Target and other fields into one string.

func (*RecordConfig) Copy

func (r *RecordConfig) Copy() (*RecordConfig, error)

func (*RecordConfig) MergeToTarget added in v0.1.5

func (r *RecordConfig) MergeToTarget()

MergeToTarget combines "extra" fields into .Target, and zeros the merged fields.

func (*RecordConfig) String

func (r *RecordConfig) String() (content string)

func (*RecordConfig) ToRR added in v0.1.5

func (rc *RecordConfig) ToRR() dns.RR

/ Convert RecordConfig -> dns.RR.

type RegistrarConfig

type RegistrarConfig struct {
	Name     string          `json:"name"`
	Type     string          `json:"type"`
	Metadata json.RawMessage `json:"meta,omitempty"`
}

Jump to

Keyboard shortcuts

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