示例#1
0
 def test_is_name_open_to_public(self):
     self.assertTrue(is_name_open_to_public('0.0.0.0'))
     self.assertTrue(is_name_open_to_public('::'))
     self.assertIsNone(is_name_open_to_public('192.168.1.1'))
     self.assertIsNone(is_name_open_to_public('127.0.0.1'))
     self.assertIsNone(is_name_open_to_public('localhost'))
示例#2
0
def config_open_to_public(address, server_type):
    status = True if is_name_open_to_public(address) else False
    logging.debug('{} server open to public: {}'.format(server_type, status))
    open_to_public[server_type] = status