Categorygithub.com/nic-at/rc0go
modulepackage
1.1.1
Repository: https://github.com/nic-at/rc0go.git
Documentation: pkg.go.dev

# README

rc0go

GoDoc Test Coverage

rc0go is a Go client library for accessing the RcodeZero Anycast DNS API.

Usage

import "github.com/nic-at/rc0go"

Using your API token construct a new rcode0 client, then use the various services on the client to access different parts of the rcode0 Anycast DNS API. For example:

rc0client := rcode0.NewClient("myapitoken")

// List all your zone entries which are managed by rcode0
zones, _, err := rc0client.Zones.List()

// Add a new zone to rcode0
statusResponse, err := rc0client.Zones.Create("rcodezero.at", "master", []string{})

// Get a single zone
zone, err := rc0client.Zones.Get("rcodezero.at")

// Add an "A" DNS resource record to the
rrsetCreate := []*rc0go.RRSetEdit{{
    Type:   "A",
    Name: 	"www.rcodezero.at.",
    ChangeType: rc0go.ChangeTypeADD,
    Records:    []*rc0go.Record{{
        Content: "10.10.0.1",
    }},
}}

statusResponse, err = rc0client.RRSet.Create("rcodezero.at", rrsetCreate)

Some code snippets are provided within the https://github.com/nic-at/rc0go/tree/master/example directory.

Services

As defined in rcode0 docs the API is structured in different groups. These are:

Zone Management
Zone Statistics
Account Statistics
Message Queue
Account Settings
Reports

Each of the groups is aimed to be implemented by a Go service object (f.e. rc0go.ZoneManagementService) which in turn provides the corresponding methods of the group. DNSSEC (rc0go.DNSSECService), however, is defined as separate service object.

Each method contains the reference to original docs to maintain a consistent content.

Rate Limiting

The API is rate limited. Additional client support will be added soon.

Status Response

Some endpoints (like adding a new zone to rcode0) return a 201 Created status code with a status response. Status response is defined in rc0go.StatusResponse struct and contains only two fields - status and message.

statusResponse, err := rc0client.Zones.Create("rcodezero.at", "master", []string{})
if eq := strings.Compare("ok", statusResponse.Status); eq != 0 {
    log.Println("Error: " + statusResponse.Message)
}

Pagination

Some requests (like listing managed zones or rrsets) support pagination. Pagination is defined in the rc0go.Page struct (with original data returned within rc0go.Page.Data field). Pagination options will be supported soon.

Contributing

Contributions are most welcome!

Any changes without tests are not accepted!

  1. Fork it
  2. Create your feature branch (git checkout -b feature-abc)
  3. Commit and sign your changes (git commit -am "Add ..." -m "Fix ..." -m "Change ... a.s.o.")
  4. Push to the branch (git push origin feature-abc)
  5. Create new Pull Request

License

rc0go released under MIT license, refer LICENSE file.

# Packages

These are some examples of how the client-lib can be used For great experience just run (): $ RC0_API_KEY=YOUR_API_KEY go run main.go .

# Functions

NewClient returns a new rcode0 API client.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
RC0AccSecondaries is used for PUT and DELETE PUT: configures the account setting “secondaries”.
RC0AccSettings is used for GET GET: get global account settings.
{?days}.
{?days}.
{?days}.
{?days}.
{?days}.
{?days}.
RC0AccTsigout is used for PUT and DELETE PUT: configures the TSIG key used for outbound zone transfers.
RC0AckMessage is used for DELETE DELETE: acknowlegdes (and deletes) the message with the given id rcode0 API docs: https://my.rcodezero.at/api-doc/#api-message-queue-ack-message.
RC0Messages is used for GET GET: retrieves the oldest unacknowledged message from the message queue.
{?month}.
{?day}.
RC0ReportsProblematiczones is used for GET GET: get global account settings.
{?month}.
RC0Zone is used for GET, PUT and DELETE GET: get details of a configured zone PUT: update a zone DELETE: removes a zone from the RcodeZero Anycast network rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-details.
RC0ZoneDNSSecDSREMOVED is used for POST (available on test system only) POST: simulates that the DS records of all KSKs of a certain domain were removed from the parent zone.
RC0ZoneDNSSecDSSEEN is used for POST (available on test system only) POST: Simulates that the DS records of all KSKs of a certain domain were seen in the parent zone.
RC0ZoneDNSSecDSUpdate is used for POST POST: acknowledges a DS update rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-acknowledge-ds-update.
RC0ZoneDNSSecKeyRollover is used for POST POST: starts a DNSSEC key rollover rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-key-rollover.
RC0ZoneDNSSecSign is used for POST POST: starts DNSSEC signing of a zone.
RC0ZoneDNSSecUnsign is used for POST POST: stops DNSSEC signing of a zone, reverting the zone to unsigned.
RC0ZoneRRSets is used for GET and PATCH GET: get the RRsets for given zone.
RC0Zones is used for GET and POST GET: returns a list of configured zones (paginated) POST: adds a new zone (master or slave) to the anycast network.
RC0ZoneStatsMagnitude is used for GET GET: Get the DNS magnitude for a given zone for the last 180 days.
RC0ZoneStatsNXDomains is used for GET GET: Returns yesterdays top 10 labels and QTYPE answered with NXDOMAIN.
RC0ZoneStatsQNames is used for GET GET: Returns yesterdays top 10 QNAMEs with QTYPE for the given domain.
RC0ZoneStatsQueries is used for GET GET: Get the total number of queries and the number of queries answered with NXDOMAIN for the given zone for the last 180 days (max.) rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-statistics-queries.
RC0ZoneTransfer is used for POST POST: queues a zone transfer dnssecRequest for the given zone.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
No description provided by the author
.
No description provided by the author
.
No description provided by the author
.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
.
.
.
Zone struct.
ZoneCreate is used for adding a new zone to rc0.
ZoneEdit is used to change the type (slave/master) of the zone on rc0.

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ZoneManagementService handles communication with the zone related methods of the rcode0 API.
No description provided by the author