Skip to content

libdns/httpnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http.net DNS for libdns

Go Reference

This package implements the libdns interfaces for http.net, allowing DNS records to be managed via the http.net partner API.

Authenticating

Create an API token in the http.net partner portal (API documentation: https://www.http.net/docs/api/) and pass it to the provider:

import "github.com/libdns/httpnet"

provider := &httpnet.Provider{
    AuthToken: "your-api-token",
}

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

The Provider implements RecordGetter, RecordAppender, RecordSetter, RecordDeleter, and ZoneLister.

Any DNS record type accepted by the http.net API is supported: records are parsed into the matching typed libdns.Record (libdns.Address, libdns.MX, libdns.TXT, …) via libdns.RR.Parse().

Caveats

TTL floor

The http.net API enforces a 60-second minimum TTL. Lower values (including zero) are silently raised to 60 before being sent, to avoid request rejection.

Asynchronous writes

Write operations may return a pending status with an empty record list. The provider handles this by performing a follow-up read, so callers still receive records with their assigned IDs.

Atomicity

Updates within a single call are applied atomically by recordsUpdate, but concurrent modifications from separate processes to the same RRset may result in inconsistent state. Ensure concurrent processes operate on different RRsets.

Testing

Unit tests run against an in-process mock server and require no credentials:

go test ./...

Integration tests against the live http.net API are opt-in via environment variables:

export HTTPNET_AUTH_TOKEN=<your-api-token>
export HTTPNET_TEST_ZONE=example.com.   # a zone you control; trailing dot required
go test -v ./...

Tests that find these variables unset are skipped automatically.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages