domainnameshop

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 13 Imported by: 3

README

Domainname.shop DNS for libdns

Go Reference

This package implements the libdns interfaces for Domainname.shop DNS.

Domainname.shop API reference

Side note: This provider has ended up with a few different names so just a bit of clarification.
The company name is Domeneshop AS (Norwegian company).
The main name in Norwegian is "Domeneshop" while in most English context they go by "Domainnameshop".
Some known URLs are domeneshop.no, domene.shop, domainnameshop.com, domainname.shop.
Package has used the name domainnameshop as reference.

Authentication

You will need a API token and API secret to use this module.
You can get tokens and secrets from the admin panel here:
https://domene.shop/admin?view=api

Example

This is a minimal example, but you can also check provider_test.go for more usage.

package main

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

	"github.com/libdns/domainnameshop"
)

func main() {

	token := os.Getenv("LIBDNS_DOMAINNAMESHOP_TOKEN")
	if token == "" {
		fmt.Printf("LIBDNS_DOMAINNAMESHOP_TEST_TOKEN not set\n")
		return
	}

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

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

	p := &domainnameshop.Provider{
		APIToken:  token,
		APISecret: secret,
	}

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

	fmt.Println(records)
}

Documentation

Overview

Package libdnstemplate implements a DNS record management client compatible with the libdns interfaces for Domainnameshop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	APIToken  string `json:"api_token"`
	APISecret string `json:"api_secret"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with Domainnameshop https://api.domeneshop.no/docs/#section/Authentication

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the records from the zone.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

GetRecords lists all the records in the zone.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.

type Service

type Service struct {
	DNS       bool   `json:"dns"`
	Email     bool   `json:"email"`
	Registrar bool   `json:"registrar"`
	Webhotel  string `json:"webhotel"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL