Skip to content

Latest commit

 

History

History
executable file
·
43 lines (30 loc) · 1.06 KB

File metadata and controls

executable file
·
43 lines (30 loc) · 1.06 KB

West.cn for libdns

Go Reference

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

Authenticating

To authenticate you need to supply your Username and APIPassword to the Provider.

Example

Here's a minimal example of how to get all your DNS records using this libdns provider

package main

import (
	"context"
	"fmt"

	"github.com/libdns/westcn"
)

func main() {
	provider := westcn.Provider{
		Username: "<Username form your west.cn account>",
		APIPassword: "<APIPassword form your west.cn account>",
	}

	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)
	}
}

For complete demo check _example/main.go