Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.82 KB

File metadata and controls

61 lines (39 loc) · 1.82 KB

Netnod DNS for libdns

godoc reference

This package implements the libdns interfaces for the Netnod Primary DNS API.

Netnod DNS services

Authenticating

To authenticate, you need a Netnod API token. Generate one through the Netnod customer portal and ensure your client IP is within the configured prefix range.

Example

provider := &netnod.Provider{
    APIToken: "your-api-token",
}

records, err := provider.GetRecords(context.Background(), "example.com.")

See provider_test.go for more usage examples.

Caveats

Rate Limiting

The Netnod API enforces rate limiting (HTTP 429). This provider automatically retries rate-limited requests using exponential backoff, respecting the Retry-After header when present. It is important to set a deadline on the context to avoid retrying indefinitely:

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
records, err := provider.GetRecords(ctx, "example.com.")

TTL

The Netnod API operates on RRsets (all records sharing a name and type). A single TTL applies to the entire RRset. If multiple records with the same name and type specify different TTLs, only the first value is used.

Atomicity

Updates are not atomic across processes. Concurrent modifications from multiple processes to the same RRset may result in inconsistent state. To avoid conflicts, ensure that concurrent processes operate on different RRsets.

Testing

Run integration tests against a live Netnod account:

NETNOD_API_TOKEN=your-token NETNOD_TEST_ZONE=example.com. go test -race -v ./...

License

BSD 3-Clause