Skip to content

libdns/leaseweb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaseweb provider for libdns

Go Reference

This package implements the libdns interfaces for Leaseweb, allowing you to manage DNS records.

Usage

Generate an API Key via the Leaseweb customer portal; 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

package main

import (
	"context"
	"fmt"
	"github.com/libdns/leaseweb"
)

func main() {
	provider := leaseweb.Provider{APIKey: "<LEASEWEB API KEY>"}

	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.

Check contributing instructions at caddy-dns/leaseweb.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages