##// END OF EJS Templates
relax ipconfig matching on Windows...
MinRK -
Show More
@@ -23,6 +23,7 b' PUBLIC_IPS : A list of public IP addresses that point to this machine.'
23 23 #-----------------------------------------------------------------------------
24 24
25 25 import os
26 import re
26 27 import socket
27 28
28 29 from .data import uniq_stable
@@ -118,6 +119,7 b' def _load_ips_ip():'
118 119 addrs.append(blocks[1].split('/')[0])
119 120 _populate_from_list(addrs)
120 121
122 _ipconfig_ipv4_pat = re.compile(r'ipv4.*(\d+\.\d+\.\d+\.\d+)$', re.IGNORECASE)
121 123
122 124 def _load_ips_ipconfig():
123 125 """load ip addresses from `ipconfig` output (Windows)"""
@@ -128,9 +130,9 b' def _load_ips_ipconfig():'
128 130 lines = out.splitlines()
129 131 addrs = ['127.0.0.1']
130 132 for line in lines:
131 line = line.lower().split()
132 if line[:2] == ['ipv4', 'address']:
133 addrs.append(line.split()[-1])
133 m = _ipconfig_ipv4_pat.match(line.strip())
134 if m:
135 addrs.append(m.group(1))
134 136 _populate_from_list(addrs)
135 137
136 138
General Comments 0
You need to be logged in to leave comments. Login now