Browse Source

In debug logging mode, use Google to determine our own IP address (IPv4 and IPv6).

Helpful for diagnosing troublesome setups.
pull/191/merge
shypike 11 years ago
parent
commit
0d14ac7763
  1. 35
      SABnzbd.py

35
SABnzbd.py

@ -1290,23 +1290,24 @@ def main():
logging.info('Python-version = %s', sys.version)
logging.info('Arguments = %s', sabnzbd.CMDLINE)
try:
s_ipv4 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s_ipv4.connect(("google.com",80))
logging.info('IP address = %s', s_ipv4.getsockname()[0])
s_ipv4.close()
except:
logging.info('could not determine IP address')
pass
try:
s_ipv6 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s_ipv6.connect(("ipv6.google.com",80))
logging.info('IPv6 address = %s', s_ipv6.getsockname()[0])
s_ipv6.close()
except:
logging.info('could not determine IPv6 address')
pass
if sabnzbd.cfg.log_level() > 1:
try:
s_ipv4 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s_ipv4.connect(('google.com', 80))
logging.debug('My IPv4 address = %s', s_ipv4.getsockname()[0])
s_ipv4.close()
except:
logging.debug('Could not determine my IPv4 address')
pass
try:
s_ipv6 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s_ipv6.connect(('ipv6.google.com', 80))
logging.debug('My IPv6 address = %s', s_ipv6.getsockname()[0])
s_ipv6.close()
except:
logging.debug('Could not determine my IPv6 address')
pass
# OSX 10.5 I/O priority setting
if sabnzbd.DARWIN:

Loading…
Cancel
Save