예제 #1
0
    def testGetIPNetworks(self):
        addresses = ipv4_networks()

        if addresses:
            for address in addresses:
                self.assertTrue(is_ip_address(address[0]), "Incorrect IP address: {}".format(address[0]))
                self.assertTrue(0 < int(address[1]) < 33, "Incorrect mask: {}".format(address[1]))
예제 #2
0
 def __init__(self, config_desc, network):
     """
     Create new server
     :param ClientConfigDescriptor config_desc: config descriptor for listening port
     :param TCPNetwork network: network that server will use
     """
     Server.__init__(self, config_desc, network)
     self.cur_port = 0  # current listening port
     self.use_ipv6 = config_desc.use_ipv6 if config_desc else False
     self.ipv4_networks = ipv4_networks()
예제 #3
0
 def __init__(self,
              config_desc: ClientConfigDescriptor,
              network: TCPNetwork) -> None:
     """
     Create new server
     :param config_desc: config descriptor for listening port
     :param network: network that server will use
     """
     self.config_desc = config_desc
     self.network = network
     self.active = True
     self.cur_port = 0  # current listening port
     self.use_ipv6 = config_desc.use_ipv6 if config_desc else False
     self.ipv4_networks = ipv4_networks()
예제 #4
0
 def testGetIPNetworks2(self, *_):
     ipv4_networks()