cloudflare

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cloudflare is a tiny Cloudflare DNS API client used for ACME DNS-01 challenges. It implements only the endpoints statute needs (list zones, create/delete TXT records) and depends solely on the standard library. Kept in internal/ so it is not part of the public API surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a tiny Cloudflare DNS API client. It implements only the endpoints needed for DNS-01 challenges: list zones and create/delete TXT records. The full-featured cloudflare-go library is intentionally avoided — it pulls in many transitive deps for capabilities we never use.

func New

func New(token string) *Client

New returns a Client authenticated with the given API token.

func (*Client) AddTXTRecord

func (c *Client) AddTXTRecord(ctx context.Context, zoneID, name, value string) (string, error)

AddTXTRecord creates a TXT record under the given zone and returns its ID so it can be deleted after the challenge resolves. TTL is set to the minimum (60s on Cloudflare's free plan) so propagation is fast.

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(ctx context.Context, zoneID, recordID string) error

DeleteRecord removes a record. Errors are returned to the caller; callers should not abort renewal on cleanup failure (the TXT record is useless after the challenge resolves and Cloudflare expires it).

func (*Client) FindZoneID

func (c *Client) FindZoneID(ctx context.Context, domain string) (string, error)

FindZoneID returns the zone ID for the zone whose name is a suffix of the given domain. The lookup walks the DNS labels from most-specific to least (a record at sub.example.com tries sub.example.com, then example.com).

Jump to

Keyboard shortcuts

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