Giter Club home page Giter Club logo

godaddy's Introduction

libdns - Universal DNS provider APIs for Go

โš ๏ธ Work-in-progress. Exported APIs are subject to change.

libdns is a collection of free-range DNS provider client implementations written in Go! With libdns packages, your Go program can manage DNS records across any supported providers. A "provider" is a service or program that manages a DNS zone.

This repository defines the core interfaces that provider packages should implement. They are small and idiomatic Go interfaces with well-defined semantics.

The interfaces include:

See full godoc for detailed documentation.

Example

To work with DNS records managed by Cloudflare, for example, we can use libdns/cloudflare:

import (
	"github.com/libdns/cloudflare"
	"github.com/libdns/libdns"
)

ctx := context.TODO()

zone := "example.com."

// configure the DNS provider (choose any from github.com/libdns)
provider := cloudflare.Provider{APIToken: "topsecret"}

// list records
recs, err := provider.GetRecords(ctx, zone)

// create records (AppendRecords is similar)
newRecs, err := provider.SetRecords(ctx, zone, []libdns.Record{
	{
		Type:  "A",
		Name:  "sub",
		Value: "1.2.3.4",
	},
})

// delete records (this example uses provider-assigned ID)
deletedRecs, err := provider.DeleteRecords(ctx, zone, []libdns.Record{
	{
		ID: "foobar",
	},
})

// no matter which provider you use, the code stays the same!
// (some providers have caveats; see their package documentation)

Implementing new provider packages

Provider packages are 100% written and maintained by the community! Collectively, we all maintain the packages for providers we individually use.

Instructions for adding new libdns packages are on this repo's wiki. Please feel free to contribute yours!

Similar projects

OctoDNS is a suite of tools written in Python for managing DNS. However, its approach is a bit heavy-handed when all you need are small, incremental changes to a zone:

WARNING: OctoDNS assumes ownership of any domain you point it to. When you tell it to act it will do whatever is necessary to try and match up states including deleting any unexpected records. Be careful when playing around with OctoDNS.

This is incredibly useful when you are maintaining your own zone file, but risky when you just need incremental changes.

StackExchange/dnscontrol is written in Go, but is similar to OctoDNS in that it tends to obliterate your entire zone and replace it with your input. Again, this is very useful if you are maintaining your own master list of records, but doesn't do well for simply adding or removing records.

go-acme/lego has support for a huge number of DNS providers (75+!), but their APIs are only capable of setting and deleting TXT records for ACME challenges.

libdns takes inspiration from the above projects but aims for a more generally-useful set of APIs that homogenize pretty well across providers. In contrast to the above projects, libdns can add, set, delete, and get arbitrary records from a zone without obliterating it (although syncing up an entire zone is also possible!). Its APIs also include context so long-running calls can be cancelled early, for example to accommodate on-line config changes downstream. libdns interfaces are also smaller and more composable. Additionally, libdns can grow to support a nearly infinite number of DNS providers without added bloat, because each provider implementation is a separate Go module, which keeps your builds lean and fast.

In summary, the goal is that libdns providers can do what the above libraries/tools can do, but with more flexibility: they can create and delete TXT records for ACME challenges, they can replace entire zones, but they can also do incremental changes or simply read records.

Record abstraction

How records are represented across providers varies widely, and each kind of record has different fields and semantics. In time, our goal is for the libdns.Record type to be able to represent most of them as concisely and simply as possible, with the interface methods able to deliver on most of the possible zone operations.

Realistically, libdns should enable most common record manipulations, but may not be able to fit absolutely 100% of all possibilities with DNS in a provider-agnostic way. That is probably OK; and given the wide varieties in DNS record types and provider APIs, it would be unreasonable to expect otherwise. We are not aiming for 100% fulfillment of 100% of users' requirements; more like 100% fulfillment of ~90% of users' requirements.

godaddy's People

Contributors

artknight avatar damnever avatar kmei3560 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kmei3560

godaddy's Issues

GetRecords not paging large zone file results

It seems that GetRecords() is not paging the results, which results in a truncated listing if the results exceed some number. Research is needed to identify Godaddy's pager limit and then implement automatic paging so all results are always returned.

I am working with a zone that has > 1000 records and I can see that they are currently being truncated.
Thank you

Possible issue related to delete in large Godaddy zone

Hello, I am using certmagic library along with multiple DNS providers including this one.

I am concerned that the DeleteRecords method appears to be updating the entire zone at once. I will try to track down the Godaddy API to confirm if this is the only way.

Our Godaddy zone is very large and contains more than 1000 records. Today for the first time we had an incident that caused about 50% of our GoDaddy zone to get deleted - based on our logs, I think this may have occurred during the ACME portions involving delete of the TXT record.

No errors were logged from either certmagic or our code (everything appeared normal) - however, about 50% of our zone disappeared after these transactions. Fortunately we had a backup and were able to restore. However, Godaddy support was not helpful and/or unable to confirm that the zone issue was related to a specific API transaction.

I would prefer if the delete operations could be more atomic - to reduce risk on other records. However, I understand this may not be possible if the Godaddy API does not support it.

Thanks

PS: here are the supported GoDaddy API methods related to DNS:
godaddy_dns_api

PPS: sorry, long day. In looking at their DELETE method... I wonder if this would be safer. If requires the type and name, so that would be an atomic transaction. It would safer to iterate in a loop of 100 atomic API calls to delete 100 records ... vs 1 API call deleting the 100 records.

PPPS: I'm a Github newb, but should be able to submit a PR for this updated logic if wanted. May just take me a few days.

not honoring TTL in API requests

I've just learned that the TTL setting is not working correctly for the AppendRecords method. In all cases, it seems that TTL is not sent in the call, which results in GoDaddy defaulting (or changing) records to 600 seconds.

I briefly reviewed the provider.go code and I think the issue is in the struct data (payload)... looks like only the record value is being sent. I should be able to fix this.

Thank you

GoDaddy rate limiting of API calls not implemented

GoDaddy returns a 429 code when API calls exceed their rate limit of 60 calls per minute (per here). Ideally this provider library should detect 429 responses and handle with an exponential backoff or similar logic.

I have not experienced this problem yet, but I can see how exceeding 60 calls in a minute could be possible.
Thank you

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.