| 88 | self._initialized = False |
| 89 | |
| 90 | def _check_localhost(self): |
| 91 | response = b"" |
| 92 | |
| 93 | try: |
| 94 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
| 95 | s.connect(("", 53)) |
| 96 | s.send(binascii.unhexlify("6509012000010000000000010377777706676f6f676c6503636f6d00000100010000291000000000000000")) # A www.google.com |
| 97 | response = s.recv(512) |
| 98 | except: |
| 99 | pass |
| 100 | finally: |
| 101 | if response and b"google" in response: |
| 102 | raise socket.error("another DNS service already running on '0.0.0.0:53'") |
| 103 | |
| 104 | def pop(self, prefix=None, suffix=None): |
| 105 | """ |