@@ -0,0 +1,739 @@
+import logging%0Aimport os%0Aimport platform%0Aimport requests%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Adef address_by_route():%0A    logger.debug(%22Finding address by querying local routing table%22)%0A    addr = os.popen(%22/sbin/ip route get 8.8.8.8 %7C awk '%7Bprint $NF;exit%7D'%22).read().strip()%0A    logger.debug(%22Address found: %7B%7D%22.format(addr))%0A    return addr%0A%0A%0Adef address_by_query():%0A    logger.debug(%22Finding address by querying remote service%22)%0A    addr = requests.get('https://api.ipify.org').text%0A    logger.debug(%22Address found: %7B%7D%22.format(addr))%0A    return addr%0A%0A%0Adef address_by_hostname():%0A    logger.debug(%22Finding address by using local hostname%22)%0A    addr = platform.node()%0A    logger.debug(%22Address found: %7B%7D%22.format(addr))%0A    return addr%0A

Implement host address heuristics (#558, #466)