A tiny Go application that updates Cloudflare DNS records with your current public IPv4 address. This tool is meant for users with dynamic IP addresses who want to keep their domain names pointing to their current location.
It should work right now, but this is still a work in progress
This is the easiest way to install the application. The binary will be automatically downloaded and installed to your Go bin directory.
Prerequisites:
- Go 1.24.5 or higher installed and in your PATH
Installation:
go install github.com/frogfreg/cloudflare-ddns@latestRunning the application:
# The binary will be available in your Go bin directory
cloudflare-ddnsNote: Make sure your Go bin directory is in your PATH. On Unix systems, this is usually ~/go/bin. On Windows, it's typically %GOPATH%\bin or %USERPROFILE%\go\bin.
Build the application from source code for your specific platform.
Prerequisites:
- Go 1.24.5 or higher
- Git (to clone the repository)
Build steps:
- 
Clone the repository: git clone https://github.com/frogfreg/cloudflare-ddns.git cd cloudflare-ddns
- 
Build the application: go build -o cloudflare-ddns main.go 
- 
Run the application: ./cloudflare-ddns 
Alternative build options:
- 
Build with optimizations (smaller binary size): go build -ldflags="-s -w" -o cloudflare-ddns main.go
- 
Build for a different platform (cross-compilation): # For Linux GOOS=linux GOARCH=amd64 go build -o cloudflare-ddns-linux main.go # For Windows GOOS=windows GOARCH=amd64 go build -o cloudflare-ddns.exe main.go # For macOS GOOS=darwin GOARCH=amd64 go build -o cloudflare-ddns-darwin main.go 
On first run, the application will create a config.toml file with default values in the directory where the program was executed. You need to update this file with your Cloudflare credentials and domain information.
Edit the config.toml file and update the following values:
zone-id = "your-zone-id"
dns-record-id = "your-dns-record-id"
cloudflare-email = "your-email@example.com"
cloudflare-api-key = "your-api-key"
domain-name = "your-domain.com"
ttl = 1
type = "A"| Parameter | Description | 
|---|---|
| zone-id | Your Cloudflare Zone ID | 
| dns-record-id | The DNS record ID to update | 
| cloudflare-email | Your Cloudflare account email | 
| cloudflare-api-key | Your Cloudflare API key | 
| domain-name | The domain name to update (e.g., "home.example.com") | 
| ttl | Time to live for the DNS record (in seconds). 1 means automatic | 
| type | DNS record type (currently supports "A" records) | 
You can get the required credentials on the Cloudflare dashboard. A domain registered with cloudflare is required.
./cloudflare-ddnsThe application will:
- Load configuration from config.toml(or create it with default values and exit)
- Check your current public IP address
- Compare it with the last known IP (stored in last-ip.txt)
- Update the Cloudflare DNS record if the IP has changed
- Continue monitoring every 30 minutes
- IP Detection: The application fetches your current public IP from https://api.ipify.org. This will be configurable in via the config file in the future
- State Management: It stores the last known IP in last-ip.txtto avoid unnecessary API calls
- DNS Update: When the IP changes, it updates the specified Cloudflare DNS record via the Cloudflare API
- Scheduling: The application runs continuously, checking for IP changes every 30 minutes. This should be configurable in the future as well.
- Uses ipify.org for public IP detection
- Built with Viper for configuration management
- Integrates with Cloudflare API
- Make this more easily configurable and simple to use