If the domain is not pointing to this ip address, then we need to notify the user that the domain is not pointing to this ip address. This can cause domain-renew/domain-add to fail.
Solution
On startup we need to check for all required domains and if they are not valid notify user. We should be able to bring this into golang natively without any command calls.
# Check if domain points here
checkdomain () {
wanip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
# Allows us to use root domain if blank
if [[ $1 == "" ]]; then
dnsip="$(dig +short $GLOBAL_DOMAIN @resolver1.opendns.com)"
if [[ ! $wanip == $dnsip ]]; then
echo "$GLOBAL_DOMAIN ($dnsip) is not pointing to your ip $wanip"
exit 1
fi
else
dnsip="$(dig +short $1.$GLOBAL_DOMAIN @resolver1.opendns.com)"
if [[ ! $wanip == $dnsip ]]; then
echo "$1 ($dnsip) is not pointing to your ip $wanip"
exit 1
fi
fi
}
Problem
If the domain is not pointing to this ip address, then we need to notify the user that the domain is not pointing to this ip address. This can cause domain-renew/domain-add to fail.
Solution
On startup we need to check for all required domains and if they are not valid notify user. We should be able to bring this into golang natively without any command calls.
See the following link for placement:
https://github.com/SiloCityLabs/docker-nas/blob/v3/server/models/app.go Start() function
You can see PortCheck as an example.
Previous code in bash:
https://jameshfisher.com/2017/08/03/golang-dns-lookup/
Configuration
Notify may be "true", "false" or "email" etc. Parsed as string. True will use server default.
Steps to Reproduce the Problem