# Copyright Hybrid Logic Ltd.  See LICENSE file for details.

"""
Network utilities.
"""

import netifaces


def get_all_ips():
    """
    Find all IPs for this machine.

    :return: ``list`` of IP addresses (``bytes``).
    """
    ips = []
    interfaces = netifaces.interfaces()
    for interface in interfaces:
        addresses = netifaces.ifaddresses(interface)
        ipv4 = addresses.get(netifaces.AF_INET)
        if not ipv4:
            continue
        for address in ipv4:
            ips.append(address['addr'])
    return ips

@@ -375,22 +375,19 @@
     
-ipv4 =
+for
  address
 es.g
@@ -386,53 +386,156 @@
 ress
-es.get(netifaces.AF_INET)%0A        if not ipv4
+_family in (netifaces.AF_INET, netifaces.AF_INET6):%0A            family_addresses = addresses.get(address_family)%0A            if not family_addresses
 :%0A  
@@ -544,16 +544,20 @@
         
+ 
+   
 continue
@@ -557,16 +557,20 @@
 ontinue%0A
+    
         
@@ -588,14 +588,30 @@
  in 
-ipv4:%0A
+family_addresses:%0A    
     

Include local IPv6 addresses