dynamicdns: Drop NAT detection as it is no longer used

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-02-01 12:30:31 -08:00 committed by James Valleroy
parent eac8f1f905
commit f107e83534
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 4 additions and 64 deletions

View File

@ -25,7 +25,7 @@ WGET=$(which wget)
WGETOPTIONS="-o /dev/null -t 3 -T 3"
EMPTYSTRING="none"
NOIP="0.0.0.0"
# how often do we poll for IP changes if we are behind a NAT?
# how often do we poll for IP changes
UPDATEMINUTES=5
# if we do not have a URL to look up public IP, how often should we do
# a "blind" update
@ -146,19 +146,6 @@ doWriteCFG()
# check if we are behind a NAT Router
echo "IPURL ${ipurl}" >> ${HELPERCFG}
if [ -z ${ipurl} ];then
echo "NAT unknown" >> ${HELPERCFG}
else
doGetWANIP
ISGLOBAL=$(ip addr ls "${default_interface}" | grep "${wanip}")
if [ -z "${ISGLOBAL}" ];then
# we are behind NAT
echo "NAT yes" >> ${HELPERCFG}
else
# we are directly connected
echo "NAT no" >> ${HELPERCFG}
fi
fi
}
# this function will read the config file from disk
@ -357,11 +344,6 @@ case ${cmd} in
echo "*/${UPDATEMINUTES} * * * * root ${0} update" > $CRONJOB
$0 update
;;
get-nat)
NAT=$(grep ^NAT $HELPERCFG 2> /dev/null | awk '{print $2}')
[ -z "${NAT}" ] && NAT="unknown"
echo ${NAT}
;;
update)
doReadCFG
dnsentry=$(nslookup "${host}"|tail -n2|grep A|sed s/[^0-9.]//g)
@ -425,15 +407,12 @@ case ${cmd} in
doReadCFG
doStatus
;;
get-timer)
echo ${UPDATEMINUTES}
;;
clean)
rm ${CFGDIR}/*
rm ${CRONJOB}
;;
*)
echo "usage: status|configure <options>|start|stop|update|get-nat|clean|success [updated IP]|failed|get-last-success"
echo "usage: status|configure <options>|start|stop|update|clean|success [updated IP]|failed|get-last-success"
echo ""
echo "options are:"
echo "-s <server> Gnudip Server address"
@ -451,7 +430,6 @@ case ${cmd} in
echo "clean delete configuration"
echo "success store update success and optional the updated IP"
echo "failed store update failure"
echo "get-nat return the detected nat type"
echo "get-last-success return date of last successful update"
;;
esac

View File

@ -29,33 +29,7 @@
{% block extra_content %}
<h3>{% trans "Status" %}</h3>
<h4>{% trans "NAT type" %}</h4>
<p>
{% if status.nat_unchecked %}
{% blocktrans trimmed %}
NAT type was not detected yet. If you do not provide an "IP Check
URL", we will not detect a NAT type.
{% endblocktrans %}
{% else %}
{% if status.no_nat %}
{% trans "Direct connection to the Internet." %}
{% else %}
{% blocktrans trimmed with timer=status.timer %}
Behind NAT. This means that Dynamic DNS service will poll
the "URL to look up public IP" for changes (the "URL to look
up public IP" entry is needed for this, otherwise IP changes
will not be detected). In case the WAN IP changes, it may
take up to {{ timer }} minutes until your DNS entry is
updated.
{% endblocktrans %}
{% endif %}
{% endif %}
</p>
<h4>{% trans "Last update" %}</h4>
<p>{{ status.last_update }}</p>
<p>{% trans "Last update" %}: {{ status.last_update }}</p>
{% endblock %}
{% block page_js %}

View File

@ -45,19 +45,7 @@ def index(request):
def get_status():
"""Return the current status."""
check_nat = _run(['get-nat'])
last_update = _run(['get-last-success'])
no_nat = check_nat.strip() == 'no'
nat_unchecked = check_nat.strip() == 'unknown'
timer = _run(['get-timer'])
return {
'no_nat': no_nat,
'nat_unchecked': nat_unchecked,
'timer': timer,
'last_update': last_update,
}
return {'last_update': _run(['get-last-success'])}
def _apply_changes(request, old_status, new_status):