mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-20 04:11:52 +00:00
ignore loopback interface
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2810 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
fc4ce83372
commit
a74e728246
1 changed files with 7 additions and 3 deletions
|
|
@ -342,14 +342,18 @@ class Resolver(object):
|
|||
self.add_addrinfo(addr, interface=True)
|
||||
|
||||
def read_local_ifaddrs (self):
|
||||
"""all active interfaces' ip addresses"""
|
||||
"""
|
||||
IP addresses for all active interfaces.
|
||||
@return: list of IP addresses
|
||||
@rtype: list of strings
|
||||
"""
|
||||
if not sys.platform.startswith('linux'):
|
||||
# only Linux is supported right now
|
||||
return []
|
||||
import linkcheck.dns.ifconfig
|
||||
ifc = linkcheck.dns.ifconfig.IfConfig()
|
||||
return [ifc.getAddr(iface) for iface in ifc.getInterfaceList()
|
||||
if ifc.isUp(iface)]
|
||||
return [ifc.getAddr(iface) for iface in ifc.getInterfaceList() \
|
||||
if ifc.isUp(iface) and not ifc.isLoopback(iface)]
|
||||
|
||||
def add_addrinfo (self, host, interface=False):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue