easydns

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 11 Imported by: 4

README

EasyDNS for libdns

Go Reference

This package implements the libdns interfaces for EasyDNS, allowing you to manage DNS records.

To manage and create token and key information for your account, navigate to https://cp.easydns.com/manage/security/.

Example usage can be found in the _example directory in this repository.

Constraints:

  • Minimum TTL allowed 5 mins (300 seconds), a TTL less than 300 will be set to 300

Documentation

Overview

Package easydns implements a DNS record management client compatible with the libdns interfaces for EasyDNS. See https://cp.easydns.com/manage/security/ to manage Token and Key information for your account.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEntry

type AddEntry struct {
	Domain   string `json:"domain,omitempty"`
	Host     string `json:"host,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Priority int    `json:"prio,omitempty"`
	Type     string `json:"type,omitempty"`
	Rdata    string `json:"rdata,omitempty"`
}

AddEntry is the request body for adding a record to a zone (PUT request)

type Provider

type Provider struct {
	// EasyDNS API Token (required)
	APIToken string `json:"api_token,omitempty"`
	// EasyDNS API Key (required)
	APIKey string `json:"api_key,omitempty"`
	// EasyDNS API URL (defaults to https://rest.easydns.net)
	APIUrl string `json:"api_url,omitempty"`
}

Provider facilitates DNS record manipulation with EasyDNS.

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.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

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. It returns the updated records.

type UpdateEntry

type UpdateEntry struct {
	Host  string `json:"host,omitempty"`
	TTL   int    `json:"ttl,omitempty"`
	Type  string `json:"type,omitempty"`
	Rdata string `json:"rdata,omitempty"`
}

UpdateEntry is the request body for updating a record in a zone (POST request)

type ZoneRecordResponse

type ZoneRecordResponse struct {
	Timestamp int `json:"tm,omitempty"` // Result Timestamp
	Data      []struct {
		Id           string `json:"id,omitempty"`
		Domain       string `json:"domain,omitempty"`
		Host         string `json:"host,omitempty"`
		TTL          string `json:"ttl,omitempty"`
		Priority     string `json:"prio,omitempty"`
		Type         string `json:"type,omitempty"`
		Rdata        string `json:"rdata,omitempty"`
		LastModified string `json:"last_mod,omitempty"`
	} `json:"data,omitempty"`
	Count  int `json:"count,omitempty"`
	Total  int `json:"total,omitempty"`
	Start  int `json:"start,omitempty"`
	Max    int `json:"max,omitempty"`
	Status int `json:"status,omitempty"`
}

ZoneRecordResponse is the response from the EasyDNS API for a zone record request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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