Documentation ¶
Index ¶
Constants ¶
const ( AutomaticTTL uint = 1 DefaultTTL uint = 120 )
Variables ¶
var ( // ErrEmptyIDUnsupported happens when an empty ID in the DNS Record // has been found. This is not supported yet! ErrEmptyIDUnsupported = errors.New("Empty DNS record id is not supported yet") // ErrEmptyRecordName is a DNS Record validation error, when the Name field // is not setted correctly. ErrEmptyRecordName = errors.New("DNS record name url is empty") // ErrEmptyRecordContent is a DNS Record validation error, when the Content // field is not setted correctly. ErrEmptyRecordContent = errors.New("DNS record content is empty") )
var ( // ErrNilHTTPClient happens if the http Client used // to make http requests is nil. ErrNilHTTPClient = errors.New("http client specified is nil") )
Functions ¶
func NewRequest ¶
func NewRequest(ctx context.Context, config APIConfig, record Record, opts ...Option) (<-chan Result, error)
NewRequest takes API configuration, DNS record to keep update, and optional parameters and returns a channel that will emit Results every time a refresh request will be done. A context.Context can be used to cancel the execution of the refresh.
Types ¶
type APIConfig ¶
APIConfig represent the configuration for CloudFlare API.
func (APIConfig) APIDNSPath ¶
APIDNSPath returns the url path to which make the API request.
type Option ¶
type Option func(opts *Options)
Option identifies a single option that can be applied to the Options.
func ClientHTTP ¶
ClientHTTP specifies which http Client to use to make http requests. Only a non-nil client will be applied.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options can be applied to the Request object. They'll be used for every API request made by the daemon.
type Record ¶
type Record struct { ID string `json:"id",toml:"id"` Type RecordType `json:"type",toml:"type"` Name *url.URL `json:"name",toml:"name"` Content string `json:"content",toml:"content"` TTL uint `json:"ttl,omitempty",toml:"ttl,omitempty"` Proxied bool `json:"proxied,omitempty",toml:"proxied,omitempty"` }
Record identifies a DNS Record for Cloudflare API. For more informations: https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
type RecordType ¶
type RecordType int
RecordType identifies the supported DNS record type from Cloudflare API. For more informations: https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
const ( A RecordType = iota AAAA CNAME TXT SRV LOC MX NS SPF )
func (RecordType) String ¶
func (r RecordType) String() string