You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-7
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# DIGITAL OCEAN DYNAMIC IP API CLIENT
2
2
A simple script in Go language to automatically update Digital ocean DNS records if you have a dynamic IP. Since it can be compiled on any platform, you can use it along with raspberrypi etc.
3
3
4
-
To find your Dynamic IP, this program will call out to https://ipv4bot.whatismyipaddress.com for ipv4 addresses and https://ipv6bot.whatismyipaddress.com for ipv6 addresses. This is to support dual-stack environments.
4
+
To find your Dynamic IP, this program will call out to https://ipv4bot.whatismyipaddress.com for ipv4 addresses and https://ipv6bot.whatismyipaddress.com for ipv6 addresses. This is to support dual-stack environments. (These URLs can be customized; see Usage, below.)
5
5
6
6
## Requirements
7
7
Requires Git, Go 1.8+, and https://github.com/mitchellh/go-homedir for building.
@@ -18,9 +18,11 @@ Once the module is fetched, you should be able to compile the program using `go
18
18
19
19
## Usage
20
20
```bash
21
+
# clone the repo in ~/go/src/github.com/anaganisk:
create a file ".digitalocean-dynamic-ip.json" (dot prefix to hide the file) and place it user home directory and add the following json
24
+
25
+
Create a file `.digitalocean-dynamic-ip.json` (dot prefix to hide the file) and place it in your home directory. Add the following JSON (or refer to the sample configuration file, `digitalocean-dynamic-ip.sample.json`):
24
26
25
27
```json
26
28
{
@@ -29,6 +31,7 @@ create a file ".digitalocean-dynamic-ip.json" (dot prefix to hide the file) and
@@ -52,6 +55,7 @@ create a file ".digitalocean-dynamic-ip.json" (dot prefix to hide the file) and
52
55
]
53
56
}
54
57
```
58
+
55
59
The TTL can optionally be updated if passed in the configuration. Digital Ocean has a minimum TTL of 30 seconds. The `type` and the `name` must match existing records in the Digital Ocean DNS configuration. Only `types` of `A` and `AAAA` allowed at the moment.
56
60
57
61
If you want to reduce the number of calls made to the digital ocean API and have more than 20 DNS records in your domain, you can adjust the `doPageSize` parameter. By default, Digital Ocean returns 20 records per page. Digital Ocean has a max page size of 200 items.
@@ -60,22 +64,25 @@ By default, the configuration checks both IPv4 and IPv6 addresses assuming your
60
64
61
65
The `allowIPv4InIPv6` configuration option will allow adding an IPv4 address to be used in a AAAA record for IPv6 lookups.
62
66
67
+
The `ipv4CheckUrl` and `ipv6CheckUrl` configuration settings are optional. If set, they must be URLs which respond to a GET request, with a plaintext response containing only your IP address. If unset, they default to `https://ipv_bot.whatismyipaddress.com`.
68
+
63
69
```bash
64
-
#run
65
-
go build digitalocean-dynamic-ip.go
70
+
# after running `go build digitalocean-dynamic-ip.go`, run:
66
71
./digitalocean-dynamic-ip
67
72
```
68
73
69
74
Optionally, you can create the configuration file with any name wherever you want, and pass it as a command line argument:
75
+
70
76
```bash
71
-
#run
77
+
#run:
72
78
./digitalocean-dynamic-ip /path/to/my/config.json
73
79
```
74
80
75
81
You can either set this to run periodically with a cronjob or use your own method.
0 commit comments