commit 484426a1cdaa515e2d39367f5885a2ce7c09be8d Author: billy harvey Date: Wed Jan 1 00:06:47 2025 +0000 . diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bdf5d5e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM golang:latest +WORKDIR /root +ADD ddns.bash . +CMD [ "/root/ddns.bash" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/arg b/arg new file mode 100644 index 0000000..b28271c --- /dev/null +++ b/arg @@ -0,0 +1,2 @@ +PROJECT=apps +SERVICE=ddns diff --git a/build b/build new file mode 100755 index 0000000..e1e506a --- /dev/null +++ b/build @@ -0,0 +1,2 @@ +docker pull golang:latest +docker build -t primal/ddns . diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..6d98185 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,12 @@ +networks: + ddns: + +services: + ddns: + build: . + env_file: + - env + hostname: apps_ddns + image: ${IMAGE}:${VERSION} + networks: + - ddns diff --git a/ddns.bash b/ddns.bash new file mode 100755 index 0000000..8aa353b --- /dev/null +++ b/ddns.bash @@ -0,0 +1,16 @@ +#!/bin/bash +DOMN=primal.host +PASS=35f5fa4e1fc04d539260a4afaeb42371 \ +IP0='' +while true ; do + IP1=$(curl --no-progress-meter 'https://api.ipify.org?format=text') + if [[ "${IP1}" != "${IP0}" && "${IP1}" != '' ]] ; then + OP0=$(curl --no-progress-meter -X GET -d 'host=@' -d "domain=${DOMN}" -d "password=${PASS}" -d "ip=${IP1}" -G 'https://dynamicdns.park-your-domain.com/update') + OP1=$(curl --no-progress-meter -X GET -d 'host=*' -d "domain=${DOMN}" -d "password=${PASS}" -d "ip=${IP1}" -G 'https://dynamicdns.park-your-domain.com/update') + echo $(date) ${IP0} ${IP1} + IP0=${IP1} + else + echo $(date) ${IP0} ${IP1} . + fi + sleep 3661 +done diff --git a/env b/env new file mode 100644 index 0000000..5ed6d11 --- /dev/null +++ b/env @@ -0,0 +1,2 @@ +VERSION=v1.0.0 +IMAGE=gitea.primal.host/wehrv/ddns