
wandns
Index
Variables
ErrAllProvidersFailed is returned when every configured detection provider failed to return a parseable IPv4 address on a single tick.
ErrTokenMissing is returned when the configured environment variable does not contain a Cloudflare API token at construction time.
type HTTPDoer
HTTPDoer narrows the *http.Client surface to the single Do method so tests can inject a custom round-tripper without standing up a server.
type Option
Option configures the Updater. Used to inject test doubles for the HTTP client, the base URL, the logger, and the token source.
func WithBaseURL
WithBaseURL overrides the Cloudflare API base URL. Used by tests to point at an httptest.Server.
func WithHTTPClient
WithHTTPClient overrides the default *http.Client.
func WithLogger
WithLogger overrides the default scoped logger.
func WithToken
WithToken overrides the Cloudflare API token. When supplied, the env var named in cfg.Cloudflare.APITokenEnv is not consulted.
type Updater
Updater polls detection providers for the current WAN IP and updates a Cloudflare DNS A record when the value changes.
func New
New constructs an Updater from the given config. Reads the Cloudflare token from the configured environment variable unless overridden via WithToken so missing-token errors surface at construction time rather than first poll.
func (*Updater) Run
Run drives the polling loop until ctx is cancelled. Performs an initial tick on entry so endpoint changes are picked up promptly after the updater starts.
Generated by gomarkdoc