acmedns

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 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.

Documentation

Overview

Package acmedns is SynCloud's own ACME challenge server (acme-dns style): a small authoritative DNS server that answers the TXT records of DNS-01 challenges for one zone, so a domain at any registrar can renew wildcard certificates with a single CNAME and no DNS provider.

It is not a general name server. It answers TXT, plus the zone's SOA and NS, for names under its challenge zone, and refuses everything else.

Index

Constants

View Source
const DefaultListen = ":53"

DefaultListen is where the server listens (UDP and TCP).

View Source
const SettingKey = "acme_dns"

SettingKey holds the configuration (JSON) in the settings table.

Variables

View Source
var ErrOff = errors.New("the challenge server is not set up")

ErrOff means the server has no zone.

Functions

func ValidConfig

func ValidConfig(c Config) error

ValidConfig checks a configuration (an empty zone switches the server off).

Types

type Config

type Config struct {
	Zone string `json:"zone"` // acme.example.com ("" = off)
	NS   string `json:"ns"`   // acme-ns.example.com: an A record to IP, named by the zone's NS record
	IP   string `json:"ip"`   // the controller's public address
}

Config is what the person sets: the zone the server answers for, the name server host that points at it, and its public address.

type Server

type Server struct {

	// Listen is the address for UDP and TCP; empty means DefaultListen.
	Listen string
	// contains filtered or unexported fields
}

Server is the challenge server.

func New

func New(st *store.Store, log *slog.Logger, listen string) *Server

New makes a server that is off until Load or Configure gives it a zone.

func (*Server) Addr

func (s *Server) Addr() string

Addr is the address the server listens on ("" when it does not).

func (*Server) Close

func (s *Server) Close()

Close stops the server.

func (*Server) Config

func (s *Server) Config() Config

Config is the current configuration.

func (*Server) Configure

func (s *Server) Configure(ctx context.Context, c Config) error

Configure saves a configuration and (re)starts or stops the listeners. A listen failure does not fail the call: it is shown in the status.

func (*Server) Delete

func (s *Server) Delete(ctx context.Context, id string) error

Delete removes a value stored by Put.

func (*Server) Enabled

func (s *Server) Enabled() bool

Enabled reports whether a zone is configured (the server may still have failed to listen: Status says so).

func (*Server) Load

func (s *Server) Load(ctx context.Context) error

Load reads the saved configuration and starts listening if a zone is set.

func (*Server) Put

func (s *Server) Put(ctx context.Context, name, value string) (string, error)

Put stores a TXT value to answer at a name inside the zone and returns what to hand to Delete.

func (*Server) Status

func (s *Server) Status(ctx context.Context) Status

Status describes the server.

func (*Server) Zone

func (s *Server) Zone() string

Zone is the challenge zone ("" when off).

type Status

type Status struct {
	Config
	Enabled   bool   `json:"enabled"`
	Listen    string `json:"listen"`
	Listening bool   `json:"listening"`
	Error     string `json:"error,omitempty"`
	Records   int    `json:"records"`
}

Status is what the server is doing.

Jump to

Keyboard shortcuts

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