(self, url)
| 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 |