-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Cloudflare DNS record update support
- Loading branch information
Praveen Premaratne
committed
Apr 7, 2021
1 parent
30a2fd3
commit af2a201
Showing
8 changed files
with
519 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
.idea | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Praveen Premaratne | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
BINARY = DynDNS | ||
GOARCH = amd64 | ||
|
||
VERSION?=latest | ||
|
||
# Symlink into GOPATH | ||
GITHUB_USERNAME=praveenprem | ||
BUILD_DIR=${GOPATH}/src/github.com/${GITHUB_USERNAME}/${BINARY} | ||
BIN_DIR=${BUILD_DIR}/bin | ||
CURRENT_DIR=\$(shell pwd) | ||
BUILD_DIR_LINK=\$(shell readlink ${BUILD_DIR}) | ||
|
||
# Setup the -ldflags option for go build here, interpolate the variable values | ||
LDFLAGS = -ldflags "-X main.VERSION=${VERSION}" | ||
|
||
export GO111MODULE=on | ||
export GOPROXY=direct | ||
export GOSUMDB=off | ||
|
||
help: | ||
@echo "Usage: make [command] [option]" | ||
@echo "\nCommands:" | ||
@echo "\t run \t\t-- Run dev environment on machine" | ||
@echo "\t linux \t\t-- Build application for Linux operating systems" | ||
@echo "\t build \t\t-- Build the application for Darwin" | ||
@echo "\t package \t-- Tar installation archive of binary and resources" | ||
@echo "\t release \t-- Release new version of the application (build, package and clean)" | ||
@echo "\t install \t-- Install the binary to system" | ||
@echo "\t upgrade \t-- Upgrade Go Mod versions" | ||
@echo "\t dep \t\t-- Resolve mods in the go.mod file" | ||
@echo "\t clean \t\t-- Clean build artefacts post package" | ||
@echo "\nOptions:" | ||
@echo "\t BINARY \t-- Name of the application" | ||
@echo "\t GOARCH \t-- Architecture of the application" | ||
@echo "\t VERSION \t-- Application version" | ||
|
||
run: | ||
@go run . | ||
|
||
linux: | ||
GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BIN_DIR}/${BINARY}-linux-${GOARCH}/${VERSION}/${BINARY}/${BINARY} . | ||
|
||
build: | ||
GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BIN_DIR}/${BINARY} . | ||
|
||
package: | ||
@cp -r resources/ ${BIN_DIR}/${BINARY}-linux-${GOARCH}/${VERSION}/${BINARY}/ | ||
@mkdir -p ${BIN_DIR}/${VERSION}/ | ||
@tar -cvjf ${BIN_DIR}/${VERSION}/${BINARY}-linux-${GOARCH}.tar -C ${BIN_DIR}/${BINARY}-linux-${GOARCH}/${VERSION}/ . | ||
|
||
release: linux package clean | ||
|
||
install: | ||
install ${BIN_DIR}/${BINARY} /usr/local/bin/${BINARY} | ||
|
||
upgrade: | ||
@go get -u ./... | ||
|
||
dep: | ||
@go list -m -u all | ||
|
||
clean: | ||
@rm -rf ${BIN_DIR}/${BINARY}-*-${GOARCH} | ||
@rm -rf ${BIN_DIR}/${BINARY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# DynDNS - Dynamic DNS | ||
|
||
DynDNS is a tool to update public IP address of the network the tool is running on. | ||
This relies on [ipify.org](https://www.ipify.org/)'s API to get the public IP of your network. | ||
|
||
## Currently, supported DNS providers: | ||
- Cloudflare | ||
|
||
## Environment variables | ||
- `CF_token`: Cloudflare API Token | ||
- `Domain`: Domain name to use | ||
- `Hostname`: Subdomain of the Domain above to set the record | ||
- `CF_proxy_disabled`: If set this will disable the proxy feature of the Cloudflare. **Enabled by default** | ||
|
||
```bash | ||
export CF_token='' | ||
export Domain='' | ||
export Subdomain='' | ||
``` | ||
### Cloudflare API token | ||
Follow the [Managing API Tokens and Keys](https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys) documentation to create an API token for Cloudflare |
Oops, something went wrong.