dyndns

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 8 Imported by: 0

README

A Cloudflare dynamic DNS library in Go

GoDoc

Documentation

Overview

Package dyndns dynamically updates A/AAAA DNS records on Cloudflare.

Unlike other packages, this is intended to be used as a library (e.g. alongside an http.Server). It uses Cloudflare's 1.1.1.1 to get your public IP, and API Tokens for authentication.

See:

https://blog.cloudflare.com/api-tokens-general-availability/

Usage:

func main() {
	go dyndns.SyncDNS("example.com", "[Zone ID]", "[Edit zone DNS Token]", time.Minute)

	http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
		io.WriteString(w, "Hello, world!\n")
	})
	log.Fatal(http.ListenAndServe(":http", nil))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublicIPv4

func PublicIPv4() (string, error)

PublicIPv4 gets your public v4 IP.

func PublicIPv6

func PublicIPv6() (string, error)

PublicIPv6 gets your public v6 IP.

func SyncDNS

func SyncDNS(domain, zone, token string, polling time.Duration) error

SyncDNS enters a loop keeping A/AAAA DNS records up to date with your current public IP.

func UpdateDNS

func UpdateDNS(domain, zone, token string) error

UpdateDNS updates A/AAAA DNS records to your current public IP.

Types

This section is empty.

Jump to

Keyboard shortcuts

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