rc0go

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 14 Imported by: 4

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.

Documentation

Overview

Package rc0go provides an official client for interaction with the rcode0 Anycast DNS API in Go.

This client is highly inspired by google/go-github. The main advantage of the usage is that predefined and API-coordinated methods are already available and the further evolution of the rcode0 API is to be transparently aligned by the client so that the end users can focus on their own products or business logic without always having to maintain the interaction with the rcode0 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 zone
rrsetCreate := []*rc0go.RRSetChange{{
	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, 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.

Index

Constants

View Source
const (

	// 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
	RC0Zone = "/zones/{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. (see docs for additional info)
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zones
	RC0Zones = "/zones"

	// RC0ZoneRRSets is used for GET and PATCH
	// GET:   get the RRsets for given zone. Works for master and slave zones.
	// PATCH: adds/updates or deletes rrsets.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-rrsets
	RC0ZoneRRSets = "/zones/{zone}/rrsets"

	// RC0ZoneTransfer is used for POST
	// POST: queues a zone transfer dnssecRequest for the given zone.
	// Zone will be transfered regardless of the serial on the RcodeZero Anycast Network.
	// A zone with a greater serial on the Rcode0 network will be overwritten by the newly transferred version.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-transfer
	RC0ZoneTransfer = "/zones/{zone}/retrieve"

	// RC0ZoneDNSSecSign is used for POST
	// POST: starts DNSSEC signing of a zone.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-sign-zone
	RC0ZoneDNSSecSign = "/zones/{zone}/sign"

	// RC0ZoneDNSSecUnsign is used for POST
	// POST: stops DNSSEC signing of a zone, reverting the zone to unsigned.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-unsign-zone
	RC0ZoneDNSSecUnsign = "/zones/{zone}/unsign"

	// 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
	RC0ZoneDNSSecKeyRollover = "/zones/{zone}/keyrollover"

	// 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
	RC0ZoneDNSSecDSUpdate = "/zones/{zone}/dsupdate"

	// 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.
	// This allows to test key rollovers even if the DS of the currently active KSK was not seen in the parent zone.
	// A DSSEEN event will be pushed ot the message queue.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-simulate-dnssec-event-dsseen
	RC0ZoneDNSSecDSSEEN = "/zones/{zone}/simulate/dsseen"

	// 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.
	// This allows to subsequently “unsign” a domain.
	// A DSREMOVED event will be pushed to the message queue.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-simulate-dnssec-event-dsremoved
	RC0ZoneDNSSecDSREMOVED = "/zones/{zone}/simulate/dsremoved"

	// 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
	RC0ZoneStatsQueries = "/zones/{zone}/stats/queries"

	// RC0ZoneStatsMagnitude is used for GET
	// GET: Get the DNS magnitude for a given zone for the last 180 days.
	// The DNS magnitude reflects the popularity of a domain between 0 (low) and 10 (high).
	// The figure is based on the number of unique resolvers seen during a day.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-statistics-dns-magnitude
	RC0ZoneStatsMagnitude = "/zones/{zone}/stats/magnitude"

	// RC0ZoneStatsQNames is used for GET
	// GET: Returns yesterdays top 10 QNAMEs with QTYPE for the given domain.
	// Returns an empty array if no queries have been received for the domain
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-statistics-qnames
	RC0ZoneStatsQNames = "/zones/{zone}/stats/qnames"

	// RC0ZoneStatsNXDomains is used for GET
	// GET: Returns yesterdays top 10 labels and QTYPE answered with NXDOMAIN.
	// Returns an empty array if no (NX-)queries have been received.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-statistics-nxdomains
	RC0ZoneStatsNXDomains = "/zones/{zone}/stats/nxdomains"

	// RC0AccStatsTopZones is used for GET
	// GET: Return the Top 1000 zones from your account with the highest number of queries in the given past period.
	// Returns an empty array if no data is available
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-top-zones
	RC0AccStatsTopZones = "/stats/topzones" //{?days}

	// RC0AccStatsTopQNames is used for GET
	// GET: Returns the Top 1000 QNAMEs for zones in your account with the highest number of queries in the given past period.
	// Returns an empty array if no data is available
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-top-qnames
	RC0AccStatsTopQNames = "/stats/topqnames" //{?days}

	// RC0AccStatsTopNXDomains is used for GET
	// GET: Returns the Top 1000 QNAMEs with QTYPE answered with NXDOMAIN for zones in your account with the highest number of queries in the given past period.
	// Returns an empty array if no data is available
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-top-nxdomains
	RC0AccStatsTopNXDomains = "/stats/topnxdomains" //{?days}

	// RC0AccStatsTopDNSMagnitude is used for GET
	// GET: Returns the Top 1000 zone in your account with the highest dns magnitude in the given past period.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-top-dns-magnitude
	RC0AccStatsTopDNSMagnitude = "/stats/topmagnitude" //{?days}

	// RC0AccStatsQueries is used for GET
	// GET: Get the total number of queries and the number of queries answered with NXDOMAIN for all zones in your account for the given past period.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-queries
	RC0AccStatsQueries = "/stats/queries" //{?days}

	// RC0AccStatsCountries is used for GET
	// GET: Return the number of Queries grouped by the originating country/subregion and region for the given past period.
	// Returns an empty array if no data is available.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-statistics-countries
	RC0AccStatsCountries = "/stats/countries" //{?days}

	// RC0AccSettings is used for GET
	// GET: get global account settings. Value will be empty if an individual setting is not configured.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-settings-settings
	RC0AccSettings = "/settings"

	// RC0AccSecondaries is used for PUT and DELETE
	// PUT: configures the account setting “secondaries”.
	// Those secondaries will receive notifies and may transfer out all zones under the management of the account.
	// DELETE: removes the configured secondaries
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-settings-set-secondaries
	RC0AccSecondaries = "/settings/secondaries"

	// RC0AccTsigout is used for PUT and DELETE
	// PUT: configures the TSIG key used for outbound zone transfers.
	// DELETE: removes the configured TSIG key
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-account-settings-settings-tsigout
	RC0AccTsigout = "/settings/tsigout"

	// RC0Messages is used for GET
	// GET: retrieves the oldest unacknowledged message from the message queue.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-message-queue-poll-message
	RC0Messages = "/messages"

	// 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
	RC0AckMessage = "/messages/{id}"

	// RC0ReportsProblematiczones is used for GET
	// GET: get global account settings. Value will be empty if an individual setting is not configured.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-reports-reports-problematiczones
	RC0ReportsProblematiczones = "/reports/problematiczones"

	// RC0ReportsNXDomains is used for GET
	// GET: get all QNAMEs and QTYPE for your account which have been answered with NXDOMAIN for yesterday or today as CSV.
	// The report is updated once every hour.
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-reports-reports-nxdomains
	RC0ReportsNXDomains = "/reports/nxdomains" //{?day}

	// RC0ReportsAccounting is used for GET
	// GET: get the accounting report per day for the given month as CSV
	// Parameter: month Values: ‘YYYY-MM’
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-reports-reports-accounting
	RC0ReportsAccounting = "/reports/accounting" //{?month}

	// RC0ReportsQueryrates is used for GET
	// GET: get the number of queries per domain and day for the given month as CSV
	// Parameter: month Values: ‘YYYY-MM’
	//
	// rcode0 API docs: https://my.rcodezero.at/api-doc/#api-reports-reports-queryrates
	RC0ReportsQueryrates = "/reports/nxdomains" //{?month}
)
View Source
const (
	ChangeTypeADD    = "add"
	ChangeTypeUPDATE = "update"
	ChangeTypeDELETE = "delete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccSettingsService

type AccSettingsService service

func (*AccSettingsService) Get

func (s *AccSettingsService) Get() (*GlobalSetting, error)

Get global account settings. Value will be empty if an individual setting is not configured.

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-settings-settings-get

func (*AccSettingsService) RemoveSecondaries

func (s *AccSettingsService) RemoveSecondaries() (*StatusResponse, error)

Removes the configured secondaries

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-settings-set-secondaries-delete

func (*AccSettingsService) RemoveTSIG

func (s *AccSettingsService) RemoveTSIG() (*StatusResponse, error)

Removes the configured TSIG key

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-settings-settings-tsigout-delete

func (*AccSettingsService) SetSecondaries

func (s *AccSettingsService) SetSecondaries(secondaries []string) (*StatusResponse, error)

Configures the account setting “secondaries”. Those secondaries will receive notifies and may transfer out all zones under the management of the account

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-settings-set-secondaries-put

func (*AccSettingsService) SetTSIG

func (s *AccSettingsService) SetTSIG(tsigkey string) (*StatusResponse, error)

Configures the TSIG key used for outbound zone transfers

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-settings-settings-tsigout-put

type AccountStatsService

type AccountStatsService service

func (*AccountStatsService) TopMagnitude

func (s *AccountStatsService) TopMagnitude(days int) ([]*TopMagnitude, error)

Returns the Top 1000 zone in your account with the highest dns magnitude in the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-top-dns-magnitude-get

func (*AccountStatsService) TopNXDomains

func (s *AccountStatsService) TopNXDomains(days int) ([]*TopNXDomain, error)

Returns the Top 1000 QNAMEs with QTYPE answered with NXDOMAIN for zones in your account with the highest number of queries in the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-top-nxdomains-get

func (*AccountStatsService) TopQNames

func (s *AccountStatsService) TopQNames(days int) ([]*TopQuery, error)

Returns the Top 1000 QNAMEs for zones in your account with the highest number of queries in the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-top-qnames-get

func (*AccountStatsService) TopZones

func (s *AccountStatsService) TopZones(days int) ([]*TopZone, error)

Return the Top 1000 zones from your account with the highest number of queries in the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-top-zones-get

func (*AccountStatsService) TotalQueryCount

func (s *AccountStatsService) TotalQueryCount(days int) ([]*QueryCount, error)

Get the total number of queries and the number of queries answered with NXDOMAIN for all zones in your account for the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-queries-get

func (*AccountStatsService) TotalQueryCountPerCountry

func (s *AccountStatsService) TotalQueryCountPerCountry(days int) ([]*CountryQueryCount, error)

Return the number of Queries grouped by the originating country/subregion and region for the given past period

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-account-statistics-countries-get

type Client

type Client struct {

	// Base URL for API requests. Defaults to the rcode0 dev API, but can be
	// set to a production or test domain. BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// Version of Rcode0 API
	APIVersion string

	// API Token
	Token string

	// User agent used when communicating with the rcode0 API.
	UserAgent string

	Zones     ZoneManagementServiceInterface
	RRSet     RRSetServiceInterface
	DNSSEC    *DNSSECService
	ZoneStats *ZoneStatsService
	AccStats  *AccountStatsService
	Reports   *ReportService
	Messages  *MessageService
	Settings  *AccSettingsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) (*Client, error)

NewClient returns a new rcode0 API client.

func (*Client) NewRequest

func (c *Client) NewRequest() *resty.Request

@todo

func (*Client) ResponseToRC0StatusResponse

func (c *Client) ResponseToRC0StatusResponse(response *resty.Response) (*StatusResponse, error)

@todo

type ClientInterface added in v1.1.0

type ClientInterface interface {
	NewRequest() *resty.Request
	ResponseToRC0StatusResponse(response *resty.Response) (*StatusResponse, error)
}

type CountryQueryCount

type CountryQueryCount struct {
	CountryCode string `json:"cc, omitempty"`
	Country     string `json:"country, omitempty"`
	Region      string `json:"region, omitempty"`
	Subregion   string `json:"subregion, omitempty"`
	QueryCount  int    `json:"qc, omitempty"`
}

type DNSSECService

type DNSSECService service

func (*DNSSECService) DSUpdate

func (s *DNSSECService) DSUpdate(zone string) (*StatusResponse, error)

Acknowledges a DS update

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-acknowledge-ds-update-post

func (*DNSSECService) KeyRollover

func (s *DNSSECService) KeyRollover(zone string) (*StatusResponse, error)

Starts a DNSSEC key rollover

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-key-rollover-post

func (*DNSSECService) Sign

func (s *DNSSECService) Sign(zone string) (*StatusResponse, error)

Starts DNSSEC signing of a zone

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-sign-zone-post

func (*DNSSECService) SimulateDSREMOVEDEvent

func (s *DNSSECService) SimulateDSREMOVEDEvent(zone string) (*StatusResponse, error)

Simulates that the DS records of all KSKs of a certain domain were removed from the parent zone. This allows to subsequently “unsign” a domain. (available on test system only)

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-simulate-dnssec-event-dsremoved-post

func (*DNSSECService) SimulateDSSEENEvent

func (s *DNSSECService) SimulateDSSEENEvent(zone string) (*StatusResponse, error)

Simulates that the DS records of all KSKs of a certain domain were seen in the parent zone. This allows to test key rollovers even if the DS of the currently active KSK was not seen in the parent zone. A DSSEEN event will be pushed ot the message queue. (available on test system only)

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-simulate-dnssec-event-dsseen-post

func (*DNSSECService) Unsign

func (s *DNSSECService) Unsign(zone string) (*StatusResponse, error)

Stops DNSSEC signing of a zone, reverting the zone to unsigned

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-management-dnssec-unsign-zone-post

type GlobalSetting

type GlobalSetting struct {
	Secondaries []string `json:"secondaries"`
	TSIGOut     string   `json:"tsigout"`
}

type ListOptions added in v1.1.0

type ListOptions struct {
	// contains filtered or unexported fields
}

func NewListOptions added in v1.1.0

func NewListOptions() *ListOptions

func (*ListOptions) PageNumber added in v1.1.0

func (o *ListOptions) PageNumber() int

func (*ListOptions) PageNumberAsString added in v1.1.0

func (o *ListOptions) PageNumberAsString() string

func (*ListOptions) PageSize added in v1.1.0

func (o *ListOptions) PageSize() int

func (*ListOptions) PageSizeAsString added in v1.1.0

func (o *ListOptions) PageSizeAsString() string

func (*ListOptions) SetPageNumber added in v1.1.0

func (o *ListOptions) SetPageNumber(number int)

func (*ListOptions) SetPageSize added in v1.1.0

func (o *ListOptions) SetPageSize(size int)

type Magnitude

type Magnitude struct {
	Date      string `json:"date, omitempty"`
	Magnitude string `json:"mag, omitempty"`
}

type Message

type Message struct {
	ID      int    `json:"id"`
	Domain  string `json:"domain"`
	Date    string `json:"date"`
	Type    string `json:"type"`
	Comment string `json:"comment"`
}

type MessageService

type MessageService service

func (*MessageService) AckAndDelete

func (s *MessageService) AckAndDelete(id int) (*StatusResponse, error)

Acknowlegdes (and deletes) the message with the given id

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-message-queue-ack-message-delete

func (*MessageService) GetLatest

func (s *MessageService) GetLatest() (*Message, error)

Retrieves the oldest unacknowledged message from the message queue

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-message-queue-poll-message-get

type NXDomain

type NXDomain struct {
	Name  string `json:"qname, omitempty"`
	Type  string `json:"qtype, omitempty"`
	Count int    `json:"qc, omitempty"`
}

type Page

type Page struct {
	Data        []interface{} `json:"data"`
	CurrentPage int           `json:"current_page, omitempty"`
	From        int           `json:"from, omitempty"`
	LastPage    int           `json:"last_page, omitempty"`
	NextPageURL string        `json:"next_page_url, omitempty"`
	Path        string        `json:"path, omitempty"`
	PerPage     int           `json:"per_page, omitempty"`
	PrevPageURL string        `json:"prev_page_url, omitempty"`
	To          int           `json:"to, omitempty"`
	Total       int           `json:"total, omitempty"`
}

func (*Page) IsLastPage added in v1.1.0

func (p *Page) IsLastPage() bool

type PerDay

type PerDay struct {
	Date      string `json:"date, omitempty"`
	Queries   int    `json:"qcount, omitempty"`
	NXDomains int    `json:"nxcount, omitempty"`
}

type ProbZone

type ProbZone struct {
	Domain    string   `json:"domain, omitempty"`
	Type      string   `json:"type, omitempty"`
	DNSSEC    string   `json:"dnssec, omitempty"`
	Created   string   `json:"created, omitempty"`
	LastCheck string   `json:"last_check, omitempty"`
	Serial    int      `json:"serial, omitempty"`
	Masters   []string `json:"masters, omitempty"`
}

type Query

type Query struct {
	Name  string `json:"qname, omitempty"`
	Type  string `json:"qtype, omitempty"`
	Count int    `json:"qc, omitempty"`
}

type QueryCount

type QueryCount struct {
	Date    string `json:"date, omitempty"`
	Count   int    `json:"count, omitempty"`
	NXCount int    `json:"nxcount, omitempty"`
}

type RRSetChange added in v1.1.0

type RRSetChange struct {
	Name       string    `json:"name, omitempty"`
	Type       string    `json:"type, omitempty"`
	ChangeType string    `json:"changetype, omitempty"`
	TTL        int       `json:"ttl,omitempty"`
	Records    []*Record `json:"records, omitempty"`
}

type RRSetService

type RRSetService service

func (*RRSetService) Create

func (s *RRSetService) Create(zone string, rrsetCreate []*RRSetChange) (*StatusResponse, error)

func (*RRSetService) DecryptTXT added in v1.1.0

func (s *RRSetService) DecryptTXT(key []byte, rrType *RRType)

func (*RRSetService) Delete

func (s *RRSetService) Delete(zone string, rrsetDelete []*RRSetChange) (*StatusResponse, error)

func (*RRSetService) Edit

func (s *RRSetService) Edit(zone string, rrsetEdit []*RRSetChange) (*StatusResponse, error)

func (*RRSetService) EncryptTXT added in v1.1.0

func (s *RRSetService) EncryptTXT(key []byte, rrType *RRSetChange)

func (*RRSetService) List

func (s *RRSetService) List(zone string, options *ListOptions) ([]*RRType, *Page, error)

List all RRSets

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-rrsets-get

func (*RRSetService) SubmitChangeSet added in v1.1.0

func (s *RRSetService) SubmitChangeSet(zone string, changeSet []*RRSetChange) (*StatusResponse, error)

type RRSetServiceInterface added in v1.1.0

type RRSetServiceInterface interface {
	List(zone string, options *ListOptions) ([]*RRType, *Page, error)
	Create(zone string, rrsetCreate []*RRSetChange) (*StatusResponse, error)
	Edit(zone string, rrsetEdit []*RRSetChange) (*StatusResponse, error)
	Delete(zone string, rrsetDelete []*RRSetChange) (*StatusResponse, error)
	SubmitChangeSet(zone string, changeSet []*RRSetChange) (*StatusResponse, error)
	EncryptTXT(key []byte, rrType *RRSetChange)
	DecryptTXT(key []byte, rrType *RRType)
}

type RRType

type RRType struct {
	Name    string    `json:"name, omitempty"`
	Type    string    `json:"type, omitempty"`
	TTL     int       `json:"ttl, omitempty"`
	Records []*Record `json:"records, omitempty"`
}

type Record

type Record struct {
	Content  string `json:"content, omitempty"`
	Disabled bool   `json:"disabled, omitempty"`
}

type ReportService

type ReportService service

func (*ReportService) ProblematicZones

func (s *ReportService) ProblematicZones() ([]*ProbZone, *Page, error)

Returns the list of problematic zones (=zones with could not be checked or transferred successfully from the master server)

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-reports-reports-problematiczones-get

type StatusResponse

type StatusResponse struct {
	Status  string `json:"status, omitempty"`
	Message string `json:"message, omitempty"`
}

func (*StatusResponse) HasError added in v1.1.0

func (sr *StatusResponse) HasError() bool

type TopMagnitude

type TopMagnitude struct {
	ID        int     `json:"id, omitempty"`
	Domain    string  `json:"domain, omitempty"`
	Magnitude float32 `json:"mag, omitempty"`
}

type TopNXDomain

type TopNXDomain struct {
	NXDomain
	ID     int    `json:"id, omitempty"`
	Domain string `json:"domain, omitempty"`
}

type TopQuery

type TopQuery struct {
	Query
	ID     int    `json:"id, omitempty"`
	Domain string `json:"domain, omitempty"`
}

type TopZone

type TopZone struct {
	ID     int    `json:"id, omitempty"`
	Domain string `json:"domain, omitempty"`
	Count  int    `json:"qc, omitempty"`
}

type Zone

type Zone struct {
	ID                    int      `json:"id, omitempty"`
	Domain                string   `json:"domain, omitempty"`
	Type                  string   `json:"type, omitempty"`
	Masters               []string `json:"masters, omitempty"`
	Serial                int      `json:"serial, omitempty"`
	LastCheck             string   `json:"last_check, omitempty"`
	DNSSECStatus          string   `json:"dnssec_status, omitempty"`
	DNSSECStatusDetail    string   `json:"dnssec_status_detail, omitempty"`
	DNSSECKSKStatus       string   `json:"dnssec_ksk_status, omitempty"`
	DNSSECKSKStatusDetail string   `json:"dnssec_ksk_status_detail, omitempty"`
	DNSSECDS              string   `json:"dnssec_ds, omitempty"`
	DNSSECDNSKey          string   `json:"dnssec_dns_key, omitempty"`
	DNSSECSafeToUnsign    string   `json:"dnssec_sage_to_unsign, omitempty"`
}

Zone struct

type ZoneCreate

type ZoneCreate struct {
	Domain  string   `json:"domain, omitempty"`
	Type    string   `json:"type, omitempty"`
	Masters []string `json:"masters, omitempty"`
}

ZoneCreate is used for adding a new zone to rc0

type ZoneEdit

type ZoneEdit struct {
	Type    string   `json:"type, omitempty"`
	Masters []string `json:"masters, omitempty"`
}

ZoneEdit is used to change the type (slave/master) of the zone on rc0

type ZoneManagementService

type ZoneManagementService service

ZoneManagementService handles communication with the zone related methods of the rcode0 API.

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management

func (*ZoneManagementService) Create

func (s *ZoneManagementService) Create(zoneCreate *ZoneCreate) (*StatusResponse, error)

Add a new zone (master or slave) to the anycast network.

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zones-post

func (*ZoneManagementService) Delete

func (s *ZoneManagementService) Delete(zone string) (*StatusResponse, error)

Removes a zone

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-details-delete

func (*ZoneManagementService) Edit

func (s *ZoneManagementService) Edit(zone string, zoneEdit *ZoneEdit) (*StatusResponse, error)

Update a zone

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-details-put

func (*ZoneManagementService) Get

func (s *ZoneManagementService) Get(zone string) (*Zone, error)

Get a single zone

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-details-get

func (*ZoneManagementService) List

func (s *ZoneManagementService) List(options *ListOptions) (zones []*Zone, page *Page, err error)

List all zones

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zones-get

func (*ZoneManagementService) Transfer

func (s *ZoneManagementService) Transfer(zone string) (*StatusResponse, error)

Queues a zone transfer dnssecRequest for the given zone

rcode0 API docs: https://my.rcodezero.at/api-doc/#api-zone-management-zone-transfer-post

type ZoneManagementServiceInterface added in v1.1.0

type ZoneManagementServiceInterface interface {
	List(options *ListOptions) (zones []*Zone, page *Page, err error)
	Get(zone string) (*Zone, error)
	Create(zoneCreate *ZoneCreate) (*StatusResponse, error)
	Edit(zone string, zoneEdit *ZoneEdit) (*StatusResponse, error)
	Delete(zone string) (*StatusResponse, error)
	Transfer(zone string) (*StatusResponse, error)
}

type ZoneStatsService

type ZoneStatsService service

func (*ZoneStatsService) Magnitude

func (s *ZoneStatsService) Magnitude(zone string) ([]*Magnitude, error)

Get the DNS magnitude for a given zone for the last 180 days

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-statistics-dns-magnitude-get

func (*ZoneStatsService) NXDomains

func (s *ZoneStatsService) NXDomains(zone string) ([]*NXDomain, error)

Returns yesterdays top 10 labels and QTYPE answered with NXDOMAIN

rcode0 API doc: https://my.rcodezero.at/api-doc/#api-zone-statistics-nxdomains-get

func (*ZoneStatsService) QNames

func (s *ZoneStatsService) QNames(zone string) ([]*Query, error)

Returns yesterdays top 10 QNAMEs with QTYPE for the given domain

rcode API doc: https://my.rcodezero.at/api-doc/#api-zone-statistics-qnames-get

func (*ZoneStatsService) Queries

func (s *ZoneStatsService) Queries(zone string) ([]*PerDay, error)

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 doc: https://my.rcodezero.at/api-doc/#api-zone-statistics-queries-get

Directories

Path Synopsis
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
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

Jump to

Keyboard shortcuts

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