Skip to content

libdns/timeweb

Repository files navigation

Timeweb DNS for libdns

Go Reference

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

Authorize

To authorize you need to use Timeweb Authorization.

Example

Minimal working example of getting DNS zone records.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/libdns/libdns/timeweb-libdns"
)

func main() {

	provider = timeweb.Provider{
		ApiURL:   os.Getenv("TIMEWEB_URL"),
		ApiToken: os.Getenv("TIMEWEB_API_TOKEN"),
	}
	zone = os.Getenv("TIMEWEB_ZONE")
	ctx = context.Background()

	records, err := provider.GetRecords(ctx, zone)
	if err != nil {
		fmt.Printf("Error: %s", err)
		return
	}

	fmt.Println(records)
}

Always yours @Riskful