simplydotcom

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 11 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Simply.com for libdns

This package implements the libdns interfaces for Simply.com.

Usage

import "github.com/libdns/simplydotcom"

provider := simplydotcom.Provider{
	APIKey: "your-api-key",
}

Configuration

The provider requires one piece of information:

  • api_key: Your Simply.com API key

The API key is sent as a Bearer token and identifies the account on its own, see the Simply.com API documentation.

The following optional configuration is supported:

  • base_url: The base URL of the Simply.com API. Defaults to https://api.simply.com/2/.
  • max_retries: The maximum number of retries to perform if being rate limited. Defaults to 3.
  • account_name: No longer needed. It is still accepted so existing configurations keep working, but it is ignored.

You can get your API key from your Simply.com account dashboard.

Example

package main

import (
	"context"
	"fmt"
	"log"
	"net/netip"
	"time"

	"github.com/libdns/libdns"
	"github.com/libdns/simplydotcom"
)

func main() {
	// Initialize the provider
	provider := simplydotcom.Provider{
		APIKey: "your-api-key",
	}

	// Create new records
	records, err := provider.AppendRecords(context.Background(), "example.com", []libdns.Record{
		// A record
		&libdns.Address{
			Name: "test",
			TTL:  3600 * time.Second,
			IP:   netip.MustParseAddr("1.2.3.4"),
		},
		// TXT record
		&libdns.TXT{
			Name: "verification",
			TTL:  3600 * time.Second,
			Text: "verify-site=abcdefghijklmnopqrstuvwxyz",
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Created %d records\n", len(records))
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// AccountName is no longer needed, as the API key identifies the account.
	// It is ignored and only kept so that existing configurations keep working.
	AccountName string `json:"account_name,omitempty"`
	// APIKey is the API key for the Simply.com account. It is required.
	APIKey string `json:"api_key,omitempty"`

	// BaseURL is the base URL of the Simply.com API. Default is https://api.simply.com/2/
	BaseURL string `json:"base_url,omitempty"`

	// MaxRetries is the maximum number of retries if rate limiting occurs. Default is 3.
	MaxRetries string `json:"max_retries,omitempty"`
	// contains filtered or unexported fields
}

Provider implements the libdns interfaces for Simply.com.

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 given records from the zone if they exist in the zone and exactly match the input. If the input records do not exist in the zone, they are silently ignored. DeleteRecords returns only the the records that were deleted, and does not return any records that were provided in the input but did not exist in the zone.

DeleteRecords only deletes records from the zone that *exactly* match the input records—that is, the name, type, TTL, and value all must be identical to a record in the zone for it to be deleted.

As a special case, you may leave any of the fields libdns.Record.Type, libdns.Record.TTL, or libdns.Record.Value empty ("", 0, and "" respectively). In this case, DeleteRecords will delete any records that match the other fields, regardless of the value of the fields that were left empty. Note that this behavior does *not* apply to the libdns.Record.Name field, which must always be specified.

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 updates the zone so that the records described in the input are reflected in the output. It may create or update records or—depending on the record type—delete records to maintain parity with the input. No other records are affected. It returns the records which were set.

For any (name, type) pair in the input, SetRecords ensures that the only records in the output zone with that (name, type) pair are those that were provided in the input.

In RFC 9499 terms, SetRecords appends, modifies, or deletes records in the zone so that for each RRset in the input, the records provided in the input are the only members of their RRset in the output zone.

The Simply.com implementation does not implement support for DNSSEC-related records.

WARNING: Calls to SetRecords for Simply.com are not atomic. If an error occurs, one or more of the requested changes may have been applied.

Jump to

Keyboard shortcuts

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