https://github.com/libdns/leaseweb
https://github.com/libdns/leaseweb
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/libdns/leaseweb
- Owner: libdns
- License: mit
- Created: 2021-05-18T16:57:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-02T16:30:31.000Z (over 1 year ago)
- Last Synced: 2024-11-02T17:24:48.076Z (over 1 year ago)
- Language: Go
- Size: 26.4 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Leaseweb provider for [`libdns`](https://github.com/libdns/libdns)
=======================
[](https://pkg.go.dev/github.com/libdns/leaseweb)
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for [Leaseweb](https://leaseweb.com/), allowing you to manage DNS records.
## Usage
Generate an API Key via the [Leaseweb customer portal](https://secure.leaseweb.com/); under Administration -> API Key.
Place API Key in the configuration as `APIKey`.
## Gotcha's
- Leaseweb expects full domain (sub.example.com); where libdns does not (sub as name and example.com as zone).
- libdns might providea TTL of 0; Leaseweb validates on their supported values (defauling to 60 for now).
- Leaseweb does not expect a trailing dot in the zone; libdns provides one, so we remove it.
## Compiling
### Docker
Run:
```
docker run --rm -it -v "$PWD":/go/src/leaseweb -w /go/src/leaseweb golang:1.16
```
which will drop you in an interactive bash prompt where `go` and friends are available.
For example you can build the code with `go build`.
## Example
```go
package main
import (
"context"
"fmt"
"github.com/libdns/leaseweb"
)
func main() {
provider := leaseweb.Provider{APIKey: ""}
records, err := provider.GetRecords(context.TODO(), "example.com")
if err != nil {
fmt.Println(err.Error())
}
for _, record := range records {
fmt.Printf("%s %v %s %s\n", record.Name, record.TTL.Seconds(), record.Type, record.Value)
}
}
```
## Contributing / developing
Easiest way to get your hands dirty is to use [Caddy](https://github.com/caddyserver/caddy).
Check contributing instructions at [caddy-dns/leaseweb](https://github.com/caddy-dns/leaseweb).