Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater

Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

Motivation

Having a lab at home. behind an ip which is dynamic, I could not keep a static DNS entry, since at each change of IP I have to change the DNS entries of all my domains.

So I wrote this little program one afternoon in order to get rid of this manual task which, when it occurred when I was not at home, was very annoying, imagine you can no longer watch plex while you are with your date. Unthinkable

Usage

To use it, its really simple (2 steps)

Step 1 : Configure your updater.yaml

In config folder, edit the updater.yaml

# Interval at which the program will check if your IP has changed
ipFetchInterval: 30s

# Records entries define the rules to follow when found an ip change
records:
- #  name of the provider to use. Must be registered
  provider: ovh
  # domain to update
  domain: example.space
  # when your record is on a subdomain enter the name of
  # the sub domain here without domain extension
  # `awesome.example.space` must be `awesome`
  subDomain: null
  # Type of the record. Actually must be A or AAAA only
  type: A

Step 2: Launch it

$ ./dns-updater

How to add provider

Want to use this program but your DNS provider is not integrated? You can participate by creating your provider and a merge request

To add a new provider go to pkg/providers package and create a new file named by the name of DNS provider.

A provider must be have two function

/**
 * Definition of a Provider interface
 * Used to implement any DNS service to make it compatible for DNS Updater
 *
 * Name()       =>  Return the name of the provider. Must be unique
 * UpdateDNS()  =>  Method called when an IP changes is detected and used to update
 *                  DNS Entry on Provider
 */
type Provider interface {
	// Return the name of the provider. Must be unique
	Name() string
	// Method called when an IP changes is detected and used to update
	// DNS Entry on Provider
	UpdateDNS(domainName, subDomain string, fieldType RecordType, ip net.IP) error
}

After that, Register the new Provider on main.go file on the Registration Section

manager.RegisterProvider(providers.NewAwesomeProvider())

All contributions are welcome :)

Thanks

Thanks to ipconfig.co to provide simple curl service to know our ip

Similar Resources

The Dual-Stack Dynamic DNS client, the world's first dynamic DNS client built for IPv6.

dsddns DsDDNS is the Dual-Stack Dynamic DNS client. A dynamic DNS client keeps your DNS records in sync with the IP addresses associated with your hom

Sep 27, 2022

netcup DNS module for caddy: dns.providers.netcup

netcup DNS module for Caddy This package contains a DNS provider module for Caddy. It can be used to manage DNS records with the netcup DNS API using

Nov 9, 2022

A fork on miekg/dns (since I've already forked zmap/dns)

Alternative (more granular) approach to a DNS library Less is more. Complete and usable DNS library. All Resource Records are supported, including the

Jan 19, 2022

A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes

A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes

A pluggable "Application State Gateway" that enforces the Event Sourcing Pattern for securely persisting & broadcasting application state changes

Nov 1, 2022

netstat-nat - Display NAT entries on Linux systems

netstat-nat This is a reimplementation of the netstat-nat tool, written entirely in Go. It uses the same command line flags and almost the same output

Oct 26, 2021

A concurrent map with entries expiring after a specified interval.

go-ttlmap Go TTL Map is a concurent map with entries expiring after a specified interval. This package requires go1.14 or newer. Overview This impleme

Oct 13, 2021

A quick and dirty but useful tool to download each text/html page from the wayback machine for a specific domain and search for keywords within the saved content

wayback-keyword-search A quick and dirty but useful tool to download each text/html page from the wayback machine for a specific domain and search for

Dec 2, 2022

Parse any web page for URLs and return the HTTP response code of each one.

Parse any web page for URLs and return the HTTP response code of each one.

ParseWebPage - Fully Functional WebPage Parser Parse any web page for URLs and return the HTTP response code of each one. Creators 👤 Steven Williams

Oct 25, 2021

Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl

Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl

getsubdomain Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl Installation â–¶ go install github.c

Oct 24, 2022
Comments
  • Gandi Support

    Gandi Support

    Manque le support de Gandi mais ouais c'est propre.

    Originally posted by @rgaiffe in https://github.com/42Atomys/dns-updater/issues/1#issuecomment-1026978940

  • bug: v4.ifconfig.co is not longer resolvable

    bug: v4.ifconfig.co is not longer resolvable

    Since 1 week, the v4.ifconfig.co endpoint don't resolve anymore. the program cannot resolve the ip and crash

    9:35AM INF DNS Updater starting...
    9:35AM INF DNS Updater is running
    9:35AM INF Initializing workers for 38 entries
    9:35AM ERR cannot fetch current IP error="Get \"https://v4.ifconfig.co/ip\": dial tcp: lookup v4.ifconfig.co on 10.96.0.10:53: no such host"
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x6c5a60]
    
    goroutine 17 [running]:
    gitlab.com/atomys-universe/dns-updater/internal/pkg/ip.fetch({0x751102, 0x19})
            /build/internal/pkg/ip/ip.go:46 +0xc0
    gitlab.com/atomys-universe/dns-updater/internal/pkg/ip.fetchIPv4(...)
            /build/internal/pkg/ip/ip.go:24
    gitlab.com/atomys-universe/dns-updater/internal/pkg/ip.FetchIPChangeRoutine(0x0, 0x0)
            /build/internal/pkg/ip/state.go:21 +0x9e
    created by gitlab.com/atomys-universe/dns-updater/pkg/manager.Run
            /build/pkg/manager/worker.go:41 +0x85
    
Related tags
dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes.

dynflare dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes. How it works The current ips are determined by ask

Dec 7, 2021
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Feb 12, 2022
Ipfs-retriever - An application that retrieves files from IPFS network

ipfs-retriever This is an application that retrieves files from IPFS network. It

Jan 5, 2022
A simple DNS forwarder that forwards DNS queries to various upstreams

A simple DNS forwarder that forwards DNS queries to various upstreams. If an upstream returns NXDomain, the next upstream is tried.

Jul 8, 2022
Sep 23, 2022
Automatically register a list of domain names, add them to Cloudflare and set DNS records.

NameCannon Automatically register a list of domain names, add them as zones on Cloudflare, then add DNS records. Usage $ ./NameCannon --namesiloSecret

Jan 26, 2022
DNS Ping: to check packet loss and latency issues with DNS servers

DNSping DNS Ping checks packet loss and latency issues with DNS servers Installation If you have golang, easiest install is go get -u fortio.org/dnspi

Nov 18, 2022
Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups
Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups

goodbots - trust but verify goodbots verifies the IP addresses of respectful crawlers like Googlebot by performing reverse dns and forward dns lookups

Aug 16, 2022