Skip to content

Commit

Permalink
Merge pull request #11 from bilintsui/dev
Browse files Browse the repository at this point in the history
v1.2 stable release
  • Loading branch information
bilintsui authored Sep 10, 2020
2 parents db6f36c + 8e6d3c5 commit 5ec82fd
Show file tree
Hide file tree
Showing 7 changed files with 836 additions and 161 deletions.
102 changes: 80 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,94 @@
## Requirements
* Linux
* Perl, and module JSON(could install with "cpan install JSON")
* Perl, and module JSON, File::Basename, POSIX
* curl
* make

## Install Perl Module: JSON
* apt(like Debian, Ubuntu): apt install libjson-perl
* yum/dnf(like Fedora, RHEL, CentOS): yum install perl-JSON
* pacman(like ArchLinux): pacman -S perl-json

## Files
* ddnscd: Main program.
* ddnscd.service.example: Example of Service Unit file for systemd.
* config.json.example: config file of ddnscd.
* services/*: collections of systemd Service Unit files in different runmode.

## Usage
ddnscd <config_file>
* config_file: the path of your config file. (eg: /etc/ddnscd/config.json)
<pre>
ddnscd <-o|s|f [-p pidfile]> [-c conf]
ddnscd <-h|--help>
ddnscd <-v|--version>
</pre>

## Configs
### Example(you should delete all linefeeds in final configurations)
>{<br/>
>>"log":"/var/log/ddnscd.log",<br/>
>>"tick":600,<br/>
>>"lookup4":"",<br/>
>>"lookup6":"",<br/>
>>"root":"",<br/>
>>"domain":"",<br/>
>>"username":"",<br/>
>>"password":""<br/>
>}<br/>
* log: The path which you logs writes into.
* tick: Integer in second. The frequency of program to check your current ip. 600 for check it every 10 minutes.
### Example
<pre>
{
"confver": 4,
"log":"/var/log/dddnscd.log",
"loglevel":1,
"tick":600,
"lookup4":"https://api4.xmrx1999.com/ip.php",
"lookup6":"https://api6.xmrx1999.com/ip.php",
"deploys":
[
{
"root":"example.com",
"username":"[email protected]",
"password":"examplepassword",
"deploy":
[
{
"name": "1.ddns",
"automode": true,
"interface4": "",
"interface6": ""
},
{
"name": "2.ddns",
"automode": true,
"interface4": "",
"interface6": ""
}
]
},
{
"root":"example2.com",
"username":"[email protected]",
"password":"examplepassword2",
"deploy":
[
{
"name": "1.ddns",
"automode": true,
"interface4": "",
"interface6": ""
},
{
"name": "2.ddns",
"automode": true,
"interface4": "",
"interface6": ""
}
]
}
]
}
</pre>
### Explanation
* confver: Config Version. Currently 4 for v1.2.
* log: Filename which logs saved to.
* loglevel: Optional, default 1. 0: Errors only; 1: Errors and Updates; 2: All messages.
* tick: Optional, required when runmode=simple/forking. Unit: second. Time of intervals between each run.
* lookup4: A URL which provides your public IP(IPv4), it should return IP only.
* lookup6: A URL which provides your public IP(IPv6), it should return IP only.
* root: Your root domain. (eg: if you want to deploy "ddns.example.com", use "example.com" here.)
* domain: Your domain which you want to deploy new IP for. (eg: if you want to deploy "ddns.example.com", use "ddns.example.com" here.)
* username: Your account name. (In cloudflare, it should be your email address.)
* password: Your password. (In cloudflare, it should be your Cloudflare API Key.)
* deploys: Deploy Information Section.
>* root: Your root domain. (eg: if you want to deploy "ddns.example.com", use "example.com" here.)
>* username: Your account name. (In cloudflare, it should be your email address.)
>* password: Your password. (In cloudflare, it should be your Cloudflare API Key.)
>* deploy: Domain information and options which you want to update/create.
>>* name: Domain names which under your root domain. This name should without your root domain name. Use "@" or "" to refer your root domain.
>>* automode: Optional, use true/false, default true. Program will auto detect your existed DNS records and updated them(legacy method). If disabled, you can ask the program to update IPv4, IPv6 seperately or both through specific interface.
>>* interface4: Optional, only effects when automode=false. Define it if you want to update your IPv4 address. Use "" to use system default interface. Use interface name to Lookup your IPv4 address via specific interface.
>>* interface6: Optional, only effects when automode=false. Same with interface4 option, just the IPv6 version.
53 changes: 52 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
{"log":"/var/log/ddnscd.log","tick":600,"lookup4":"https://api4.xmrx1999.com/ip.php","lookup6":"https://api6.xmrx1999.com/ip.php","root":"","domain":"","username":"","password":""}
{
"confver": 4, # Version of configuration file. See: versions.json on https://github.com/bilintsui/ddnscd
"log":"/var/log/ddnscd/ddnscd.log", # Filename which logs saved to.
"loglevel":1, # Optional, default 1. 0: Errors only; 1: Errors and Updates; 2: All messages.
"tick":600, # Optional, required when runmode=simple/forking. Unit: second. Time of intervals between each run.
"lookup4":"https://api4.xmrx1999.com/ip.php", # URL of IPv4 Lookup service.
"lookup6":"https://api6.xmrx1999.com/ip.php", # URL of IPv6 Lookup service.
"deploys": # Deploy Information Section.
[
{
"root":"example.com", # Your root domain name.
"username":"[email protected]", # Your username.
"password":"examplepassword", # Your password.
"deploy": # List of domain names which you want to deploy to.
[
{
"name": "1.ddns", # Refer to 1.ddns.example.com.
"automode": true, # Optional, default true. When enabled, program will auto detect DNS record and update it which had already existed. You can't create a new DNS record when automode is enabled.
# You need to specify "interface4" or "interface6" or both if you want to create/update a DNS record when automode is disabled. Otherwise it will not create/update.
"interface4": "", # Optional, when automode is disabled, create/update an A record with an IPv4 address. Leave blank to use default interface.
"interface6": "" # Optional, when automode is disabled, create/update an AAAA record with an IPv6 address. Leave blank to use default interface.
},
{
"name": "2.ddns",
"automode": true,
"interface4": "",
"interface6": ""
}
]
},
{
"root":"example2.com",
"username":"[email protected]",
"password":"examplepassword2",
"deploy":
[
{
"name": "1.ddns",
"automode": true,
"interface4": "",
"interface6": ""
},
{
"name": "2.ddns",
"automode": true,
"interface4": "",
"interface6": ""
}
]
}
]
}
Loading

0 comments on commit 5ec82fd

Please sign in to comment.