linode

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 12 Imported by: 4

README

Linode for libdns

Go Reference

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

Requires a Linode API token.

This package was created for use in HugoKlepsch/caddy-dns_linode or caddy-dns/linode. Both are Caddy plugins for managing DNS records on Linode. Caddy uses this package to complete DNS-01 challenges when using Linode. It may have behaviour tailored to that use case.

Getting a token

  • Go to https://cloud.linode.com/profile/tokens (API Tokens tab)
  • Click "Create a Personal Access Token"
  • This library requires Read/Write in the "Domains" scope
  • Copy the token. It should be kept private.
  • Load it into the APIToken member when creating a new linode.Provider

Running Integration Tests

  • Requires a Linode API token
  • Should be able to run without owning a domain. The test suite tries to operate on unused domains. It follow the pattern of libdns-test-<datetime>-<four random hex digits>.example.
  • Set the LINODE_DNS_PAT environment variable to your Personal Access Token.
  • Run with this command:
go test -v -tags=integration

Documentation

Overview

Package linode implements a DNS record management client compatible with the libdns interfaces for Linode.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedType = errors.New("Unsupported DNS record type")

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// APIToken is the Linode Personal Access Token, see https://cloud.linode.com/profile/tokens.
	APIToken string `json:"api_token,omitempty"`
	// APIURL is the Linode API hostname, i.e. "api.linode.com".
	APIURL string `json:"api_url,omitempty"`
	// APIVersion is the Linode API version, i.e. "v4".
	APIVersion string `json:"api_version,omitempty"`

	DebugLogsEnabled bool `json:"debug_logs_enabled,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with Linode.

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. It returns the records that were deleted. As per the libdns interface, any deleted records must match exactly the input record (Name, Type, TTL, Value). If any of (Type, TTL, Value) are "", 0, or "", respectively, deleteDomainRecord will delete any records that match the other fields, regardless of the value of the fields that were left empty. Note: this does not apply to the Name field.

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) ListZones added in v0.5.0

func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)

ListZones lists all the zones (domains).

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.

Jump to

Keyboard shortcuts

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