def is_local_destination(self, mapping_socket):
        destination_is_local = False
        if mapping_socket.destination_ip is not None and mapping_socket.family == "AF_INET":
            for nic in self.nics:
                if NetworkInterfaceCard.ip_is_in_subnet(mapping_socket.destination_ip,
                                                        nic.ipv4_subnet_addr, nic.ipv4_subnet_mask):
                    destination_is_local = True
                    break
        elif mapping_socket.destination_ip is not None and mapping_socket.family == "AF_INET6":
            destination_ipv4 = MapSocket.ipv6_2_ipv4(mapping_socket.destination_ip)
            if destination_ipv4 != mapping_socket.destination_ip:
                for nic in self.nics:
                    if NetworkInterfaceCard.ip_is_in_subnet(destination_ipv4,
                                                            nic.ipv4_subnet_addr, nic.ipv4_subnet_mask):
                        destination_is_local = True
                        break
            else:
                #TODO: check is ipv6 in subnet ?
                for nic in self.nics:
                    if nic.ipv6_address is not None and mapping_socket.destination_ip == nic.ipv6_address:
                        destination_is_local = True
                        break
                    elif NetworkInterfaceCard.ip_is_in_subnet(mapping_socket.destination_ip,
                                                              nic.ipv4_subnet_addr, nic.ipv4_subnet_mask):
                        destination_is_local = True
                        break
        elif mapping_socket.family == "AF_UNIX":
            destination_is_local = True

        return destination_is_local
 def from_json(json_obj):
     #LOGGER.debug("DockerContainer.from_json")
     processs_json = json_obj['processs'] if json_obj['processs'] else []
     processs = []
     for process_json in processs_json:
         processs.append(DockerContainerProcess.from_json(process_json))
     last_processs_json = json_obj['last_processs'] if json_obj['last_processs'] else []
     last_processs = []
     for last_process_json in last_processs_json:
         last_processs.append(DockerContainerProcess.from_json(last_process_json))
     nics_json = json_obj['nics'] if json_obj['nics'] else []
     nics = []
     for nic_json in nics_json:
         nics.append(NetworkInterfaceCard.from_json(nic_json))
     last_nics_json = json_obj['last_nics'] if json_obj['last_nics'] else []
     last_nics = []
     for last_nic_json in last_nics_json:
         last_nics.append(NetworkInterfaceCard.from_json(last_nic_json))
     return DockerContainer(
         dcontainer_id=json_obj['did'] if json_obj['did'] else None,
         mcontainer_id=json_obj['mid'] if json_obj['mid'] else None,
         osi_id=json_obj['oid'] if json_obj['oid'] else None,
         ost_id=json_obj['ostid'] if json_obj['ostid'] else None,
         environment_id=json_obj['eid'] if json_obj['eid'] else None,
         team_id=json_obj['tid'] if json_obj['tid'] else None,
         name=json_obj['name'] if json_obj['name'] else None,
         domain=json_obj['domain'] if json_obj['domain'] else None,
         fqdn=json_obj['fqdn'] if json_obj['fqdn'] else None,
         details=json_obj['details'] if json_obj['details'] else None,
         nsenter_pid=json_obj['nsenter_pid'] if json_obj['nsenter_pid'] else None,
         processs=processs,
         last_processs=last_processs,
         nics=nics,
         last_nics=last_nics
     )