Documentation
¶
Overview ¶
Package noderings implements a DNS record management client compatible with the libdns interfaces for NodeRings DNS (https://noderings.com).
NodeRings stores records as record sets: all records with the same name and type share one TTL and are written together. AppendRecords, SetRecords and DeleteRecords therefore read the affected record sets, change them and write them back. Calls on one Provider are serialized so concurrent changes to the same record set (for example the two TXT values of a wildcard certificate) cannot overwrite each other. Changes are not atomic across record sets: if a call fails, record sets written before the failure keep their new contents.
DNSSEC records are managed by NodeRings and are not returned by the API.
Index ¶
- Constants
- type APIError
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
const ( EnvAPIToken = "NODERINGS_API_TOKEN" EnvOrganizationID = "NODERINGS_ORGANIZATION_ID" EnvAPIURL = "NODERINGS_API_URL" )
Environment variables used when the matching Provider field is empty.
const DefaultAPIURL = "https://api.noderings.com"
DefaultAPIURL is the NodeRings API used when BaseURL is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// APIToken is a NodeRings user API token or service account token.
// Defaults to $NODERINGS_API_TOKEN.
APIToken string `json:"api_token,omitempty"`
// OrganizationID selects the organization when the token belongs to more
// than one. Defaults to $NODERINGS_ORGANIZATION_ID.
OrganizationID string `json:"organization_id,omitempty"`
// BaseURL of the NodeRings API. Defaults to $NODERINGS_API_URL, then
// https://api.noderings.com.
BaseURL string `json:"base_url,omitempty"`
// HTTPClient used for API calls. Defaults to a client with a 30s timeout.
HTTPClient *http.Client `json:"-"`
// contains filtered or unexported fields
}
Provider facilitates DNS record manipulation with NodeRings DNS.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added. Records that already exist are left as they are and not returned. A record set that already exists keeps its TTL.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the specified records from the zone. It returns the records that were deleted. Type, TTL and value may be left empty to match any.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords sets the records in the zone, either by updating existing records or creating new ones. For each (name, type) in the input, the input records become the only records of that set. All input records with the same name and type must have the same TTL. It returns the records that were set.