nfsn

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 15 Imported by: 3

README

nfsn for libdns

Go Reference

This package implements the libdns interfaces for nearlyfreespeech.net, allowing you to manage DNS records hosted there.

Configuration

The Provider requires two pieces of information to operate:

  1. A Login - this is your NFSN login, i.e. the "Login Name" you provide when authenticating against https://members.nearlyfreespeech.net
  2. An APIKey - obtained by logging into NFSN, navigating to the 'profile' tab, and selecting 'Manage API Key'. More details on obtaining and managing API keys are available in the NFSN FAQs.

Caveats

The API that backs SetRecords only supports A and AAAA records. All other record types need to be deleted and re-created in separate steps.

CLI

cli/cli.go contains a (bare bones) CLI driver for the package. To use it, put an NFSN API key in a file on disk. By default the tool will look for a file called api_key.txt in the current working directory. The -f argument allows specifying an alternative location and/or filename. The -z zone argument and the -l login argument are required for all commands. The CLI tool supports the following operations in the -o argument:

  • GetRecords retrieves the set of DNS records for the specified zone and prints them to stdout.
  • AddRecord adds a new record. Takes the -t type, -n name, and -d data arguments.
  • DeleteRecord deltes a record. Takes the -t type, -n name, and -d data arguments.
  • SetRecord replaces an existing A or AAAA record transactionally (the API does not support other types of records). Takes the -t type, -n name, and -d data arguments.

Reference

Note: these require an NFSN account to access.

Documentation

Overview

Package nfsn implements a DNS record management client compatible with the libdns interfaces for nearlyfreespeech.net (NFSN)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// NFSN Member Login.
	Login string `json:"login,omitempty"`

	// NFSN API Key. API Keys can be generated from the "Profile" tab in the NFSN member interface.
	APIKey string `json:"api_key,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with nearlyfreespeech.net

func (*Provider) AppendRecords

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

See libdns.RecordAppender

func (*Provider) DeleteRecords

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

See libdns.RecordDeleter

func (*Provider) GetRecords

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

See libdns.RecordGetter

func (*Provider) SetRecords

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

See libdns.RecordSetter

NFSN does not support atomic zone modification, so after computing the operations to perform each one will be attempted serially. In the case where only some operations succeed, returns both the records that were set (if any) and an error.

Directories

Path Synopsis
CLI for testing/exercising the NFSN libdns provider
CLI for testing/exercising the NFSN libdns provider

Jump to

Keyboard shortcuts

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