providers

package
v3.16.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DNSProviderTypes = map[string]DspFuncs{}

DNSProviderTypes stores initializer for each DSP.

Notes is a collection of all documentation notes, keyed by provider type

View Source
var RegistrarTypes = map[string]RegistrarInitializer{}

RegistrarTypes stores initializer for each registrar.

Functions

func AuditRecords added in v3.8.0

func AuditRecords(dType string, rcs models.Records) error

AuditRecords calls the RecordAudit function for a provider.

func ProviderHasCapability

func ProviderHasCapability(pType string, cap Capability) bool

ProviderHasCapability returns true if provider has capability.

func RegisterCustomRecordType

func RegisterCustomRecordType(name, provider, realType string)

RegisterCustomRecordType registers a record type that is only valid for one provider. provider is the registered type of provider this is valid with name is the record type as it will appear in the js. (should be something like $PROVIDER_FOO) realType is the record type it will be replaced with after validation

func RegisterDomainServiceProviderType

func RegisterDomainServiceProviderType(name string, fns DspFuncs, pm ...ProviderMetadata)

RegisterDomainServiceProviderType adds a dsp to the registry with the given initialization function.

func RegisterRegistrarType

func RegisterRegistrarType(name string, init RegistrarInitializer, pm ...ProviderMetadata)

RegisterRegistrarType adds a registrar type to the registry by providing a suitable initialization function.

Types

type Capability

type Capability uint32

Capability is a bitmasked set of "features" that a provider supports. Only use constants from this package.

const (

	// CanAutoDNSSEC indicates that the provider can automatically handle DNSSEC,
	// so folks can ask for that.
	CanAutoDNSSEC Capability = iota

	// CanGetZones indicates the provider supports the get-zones subcommand.
	CanGetZones

	// CanUseAKAMAICDN indicates the provider support the specific AKAMAICDN records that only the Akamai EdgeDns provider supports
	CanUseAKAMAICDN

	// CanUseAlias indicates the provider support ALIAS records (or flattened CNAMES). Up to the provider to translate them to the appropriate record type.
	CanUseAlias

	// CanUseAzureAlias indicates the provider support the specific Azure_ALIAS records that only the Azure provider supports
	CanUseAzureAlias

	// CanUseCAA indicates the provider can handle CAA records
	CanUseCAA

	// CanUseDS indicates that the provider can handle DS record types. This
	// implies CanUseDSForChildren without specifying the latter explicitly.
	CanUseDS

	// CanUseDSForChildren indicates the provider can handle DS record types, but
	// only for children records, not at the root of the zone.
	CanUseDSForChildren

	// CanUseNAPTR indicates the provider can handle NAPTR records
	CanUseNAPTR

	// CanUsePTR indicates the provider can handle PTR records
	CanUsePTR

	// CanUseRoute53Alias indicates the provider support the specific R53_ALIAS records that only the Route53 provider supports
	CanUseRoute53Alias

	// CanUseSOA indicates the provider supports full management of a zone's SOA record
	CanUseSOA

	// CanUseSRV indicates the provider can handle SRV records
	CanUseSRV

	// CanUseSSHFP indicates the provider can handle SSHFP records
	CanUseSSHFP

	// CanUseTLSA indicates the provider can handle TLSA records
	CanUseTLSA

	// CantUseNOPURGE indicates NO_PURGE is broken for this provider. To make it
	// work would require complex emulation of an incremental update mechanism,
	// so it is easier to simply mark this feature as not working for this
	// provider.
	CantUseNOPURGE

	// DocCreateDomains means provider can add domains with the `dnscontrol create-domains` command
	DocCreateDomains

	// DocDualHost means provider allows full management of apex NS records, so we can safely dual-host with anothe provider
	DocDualHost

	// DocOfficiallySupported means it is actively used and maintained by stack exchange
	DocOfficiallySupported
)

func (Capability) String

func (i Capability) String() string

type CustomRType

type CustomRType struct {
	Name     string
	Provider string
	RealType string
}

CustomRType stores an rtype that is only valid for this DSP.

func GetCustomRecordType

func GetCustomRecordType(rType string) *CustomRType

GetCustomRecordType returns a registered custom record type, or nil if none

type DNSServiceProvider

type DNSServiceProvider interface {
	models.DNSProvider
}

DNSServiceProvider is able to generate a set of corrections that need to be made to correct records for a domain. Implement this only if the provider is a DNS Service Provider (can update records in a DNS zone).

func CreateDNSProvider

func CreateDNSProvider(providerTypeName string, config map[string]string, meta json.RawMessage) (DNSServiceProvider, error)

CreateDNSProvider initializes a dns provider instance from given credentials.

type DocumentationNote

type DocumentationNote struct {
	HasFeature    bool
	Unimplemented bool
	Comment       string
	Link          string
}

DocumentationNote is a way for providers to give more detail about what features they support.

func Can

func Can(comments ...string) *DocumentationNote

Can is a small helper for concisely creating Documentation Notes comments are variadic for easy ommission. First is comment, second is link, the rest are ignored.

func Cannot

func Cannot(comments ...string) *DocumentationNote

Cannot is a small helper for concisely creating Documentation Notes comments are variadic for easy ommission. First is comment, second is link, the rest are ignored.

func Unimplemented

func Unimplemented(comments ...string) *DocumentationNote

Unimplemented is a small helper for concisely creating Documentation Notes comments are variadic for easy ommission. First is comment, second is link, the rest are ignored.

type DocumentationNotes

type DocumentationNotes map[Capability]*DocumentationNote

DocumentationNotes is a full list of notes for a single provider

type DomainCreator

type DomainCreator interface {
	EnsureDomainExists(domain string) error
}

DomainCreator should be implemented by providers that have the ability to add domains to an account. the create-domains command can be run to ensure all domains are present before running preview/push. Implement this only if the provider supoprts the `dnscontrol create-domain` command.

type DspFuncs added in v3.8.0

type DspFuncs struct {
	Initializer   DspInitializer
	RecordAuditor RecordAuditor
}

DspFuncs lists functions registered with a provider.

type DspInitializer

type DspInitializer func(map[string]string, json.RawMessage) (DNSServiceProvider, error)

DspInitializer is a function to create a DNS service provider. Function will be passed the unprocessed json payload from the configuration file for the given provider.

type None

type None struct{}

None is a basic provider type that does absolutely nothing. Can be useful as a placeholder for third parties or unimplemented providers.

func (None) GetDomainCorrections

func (n None) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error)

GetDomainCorrections returns corrections to update a domain.

func (None) GetNameservers

func (n None) GetNameservers(string) ([]*models.Nameserver, error)

GetNameservers returns the current nameservers for a domain.

func (None) GetRegistrarCorrections

func (n None) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error)

GetRegistrarCorrections returns corrections to update registrars.

func (None) GetZoneRecords

func (n None) GetZoneRecords(domain string) (models.Records, error)

GetZoneRecords gets the records of a zone and returns them in RecordConfig format.

type ProviderMetadata

type ProviderMetadata interface{}

ProviderMetadata is a common interface for DocumentationNotes and Capability to be used interchangeably

type RecordAuditor added in v3.8.0

type RecordAuditor func([]*models.RecordConfig) error

RecordAuditor is a function that verifies that all the records are supportable by this provider. It returns an error related to the first record that this provider can not support.

type Registrar

type Registrar interface {
	models.Registrar
}

Registrar is an interface for a domain registrar. It can return a list of needed corrections to be applied in the future. Implement this only if the provider is a "registrar" (i.e. can update the NS records of the parent to a domain).

func CreateRegistrar

func CreateRegistrar(rType string, config map[string]string) (Registrar, error)

CreateRegistrar initializes a registrar instance from given credentials.

type RegistrarInitializer

type RegistrarInitializer func(map[string]string) (Registrar, error)

RegistrarInitializer is a function to create a registrar. Function will be passed the unprocessed json payload from the configuration file for the given provider.

type ZoneLister

type ZoneLister interface {
	ListZones() ([]string, error)
}

ZoneLister should be implemented by providers that have the ability to list the zones they manage. This facilitates using the "get-zones" command for "all" zones.

Directories

Path Synopsis
Package all is simply a container to reference all known provider implementations for easy import into other packages
Package all is simply a container to reference all known provider implementations for easy import into other packages
Package hexonet implements a registrar that uses the hexonet api to set name servers.
Package hexonet implements a registrar that uses the hexonet api to set name servers.
Package namedotcom implements a registrar that uses the name.com api to set name servers.
Package namedotcom implements a registrar that uses the name.com api to set name servers.

Jump to

Keyboard shortcuts

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