4 stable releases
1.0.3 | Dec 10, 2024 |
---|---|
1.0.1 | Nov 20, 2024 |
1.0.0 | Nov 17, 2024 |
#163 in Command line utilities
571 downloads per month
27KB
376 lines
DynaFlare
Simple IPv4 DDNS client for Cloudflare. Works on the Raspberry Pi!
1. Obtaining DynaFlare
Build from source
git clone https://github.com/Yzen90/dynaflare.git
cd dynaflare
cargo build --release
Install crate
cargo install dynaflare
Download a pre-built binary
2. Configuration
DynaFlare looks in the current working directory for a configuration.toml
file with the following fields:
-
interval
(Optional): String with one or more pairs of a positive integer immediately followed by 'days', 'h', 'min', 's', 'ms', 'μs' or 'ns'. If not provided, dynaflare will check and update de provided records only once and then exit. Otherwise dynaflare will keep runing and continuously check at this interval for public ip changes and update the dns records when necessary. -
zone_id
(Required): ID of the Clouldflare Zone that contains the provided dns records. -
api_token
(Required): Cloudflare API token with DNS read and edit permissions for the provided zone. -
records
(Required): DNS records to update or create with the current public IPv4 address. -
count_repeated_errors
(Optional): Defaults tofalse
. Iftrue
, consecutive identical errors are shown only the first time, then the additional error count is shown until there is a successful request or a different error. -
log_level
(Optional): The log level filter, defaults toINFO
. Valid values areTRACE
,DEBUG
,INFO
,WARN
,ERROR
, orOFF
.
Example configuration.toml
interval = "1min 30s"
zone_id = "cloudflare zone id here"
api_token = "cloudflare api token here"
records = ["dynamic.example.com"]
count_repeated_errors = true
3. systemd service
A systemd service unit file template for DynaFlare is provided in the repository that can be used as follows to install a systemd service:
export DYNAFLARE_USER=dynaflare # User that the process will be executed as
export DYNAFLARE_WDIR=/usr/local/etc/dynaflare # Directory where configuration.toml is located
export DYNAFLARE_EXEC=/usr/local/bin/dynaflare # Path of dynaflare executable file
envsubst < dynaflare.service | sudo tee /etc/systemd/system/dynaflare.service
sudo systemctl start dynaflare
sudo systemctl status dynaflare
sudo systemctl enable dynaflare
Example systemd unit file
[Unit]
Description=DynaFlare, a simple DDNS client for Cloudflare
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=dynaflare
WorkingDirectory=/usr/local/etc/dynaflare
ExecStart=/usr/local/bin/dynaflare
[Install]
WantedBy=multi-user.target
Dependencies
~18–28MB
~559K SLoC