ddns
This commit is contained in:
@@ -24,14 +24,17 @@ data:
|
||||
update.sh: |
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
V4="$(curl -4 -fsS --max-time 5 https://ipv4.icanhazip.com || true)"
|
||||
V6="$(curl -6 -fsS --max-time 5 https://ipv6.icanhazip.com || true)"
|
||||
|
||||
while IFS=, read -r HOST PASS; do
|
||||
[ -z "${HOST:-}" ] && continue
|
||||
if [ "${IPV6_ONLY:-1}" = "1" ]; then
|
||||
curl -6 -fsS "https://dyn.dns.he.net/nic/update?hostname=${HOST}&password=${PASS}" || echo "v6 fail $HOST" >&2
|
||||
else
|
||||
curl -4 -fsS "https://dyn.dns.he.net/nic/update?hostname=${HOST}&password=${PASS}" || echo "v4 fail $HOST" >&2
|
||||
curl -6 -fsS "https://dyn.dns.he.net/nic/update?hostname=${HOST}&password=${PASS}" || echo "v6 fail $HOST" >&2
|
||||
fi
|
||||
# Update A via IPv4 transport if you want IPv4 too:
|
||||
[ -n "$V4" ] && curl -4 -fsS --connect-timeout 5 \
|
||||
"https://dyn.dns.he.net/nic/update?hostname=${HOST}&password=${PASS}&myip=${V4}" || true
|
||||
# Update AAAA via IPv4 transport (key part):
|
||||
[ -n "$V6" ] && curl -4 -fsS --connect-timeout 5 \
|
||||
"https://dyn.dns.he.net/nic/update?hostname=${HOST}&password=${PASS}&myip=${V6}" || true
|
||||
done < /secrets/hosts.csv
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
|
||||
Reference in New Issue
Block a user