Giter Site home page Giter Site logo

rc0go's Introduction

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.

rc0go's People

Contributors

mikeat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

df-a

rc0go's Issues

Support TTL in records

Hi,
it currently seams that the client does not support TTL.

Can it be added?

Thanks a lot
Manuel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.