Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 1.2 KB

README.md

File metadata and controls

62 lines (44 loc) · 1.2 KB

INWX for libdns

godoc reference

This package implements the libdns interfaces for the INWX API

Authenticating

To authenticate you need to supply your INWX Username and Password.

Example

Here's a minimal example of how to get all DNS records for zone. See also: provider_test.go

package main

import (
	"context"
	"fmt"
	"os"
	"time"

	"github.com/libdns/libdns/inwx"
)

func main() {
	user := os.Getenv("LIBDNS_INWX_USER")
	if user == "" {
		fmt.Printf("LIBDNS_INWX_USER not set\n")
		return
	}

	pass := os.Getenv("LIBDNS_INWX_USER")
	if pass == "" {
		fmt.Printf("LIBDNS_INWX_USER not set\n")
		return
	}

	zone := os.Getenv("LIBDNS_INWX_ZONE")
	if zone == "" {
		fmt.Printf("LIBDNS_INWX_ZONE not set\n")
		return
	}

	p := &inwx.Provider{
		AuthUsername: user,
		AuthPassword: pass,
	}

	records, err := p.GetRecords(context.WithTimeout(context.Background(), time.Duration(15*time.Second)), zone)
	if err != nil {
		fmt.Printf("Error: %s", err.Error())
		return
	}

	fmt.Println(records)
}