MCPcopy Create free account
hub / github.com/EASY233/Finger / factory

Method factory

lib/IpFactory.py:28–44  ·  view source on GitHub ↗
(self, url)

Source from the content-addressed store, hash-verified

26 return host
27
28 def factory(self, url):
29 try:
30 ip_list = []
31 host = self.parse_host(url)
32 items = socket.getaddrinfo(host, None)
33 for ip in items:
34 if ip[4][0] not in ip_list:
35 ip_list.append(ip[4][0])
36 if len(ip_list) > 1:
37 return 1, ip_list
38 else:
39 for cdn in self.cdns:
40 if ipaddress.ip_address(ip_list[0]) in ipaddress.ip_network(cdn):
41 return 1, ip_list
42 return 0, ip_list
43 except Exception as e:
44 return 0, ip_list
45

Callers 1

responseMethod · 0.80

Calls 1

parse_hostMethod · 0.95

Tested by

no test coverage detected