| 480 | |
| 481 | # replaces the self keyword, but could be expanded to any keyword replacement |
| 482 | def _replace_self(self, ips): |
| 483 | # Deal with the user putting "self" in a rule (helpful if you don't know your IP) |
| 484 | for ip in ips: |
| 485 | if ip.lower() == 'self': |
| 486 | try: |
| 487 | self_ip = socket.gethostbyname(socket.gethostname()) |
| 488 | except socket.error: |
| 489 | print(">> Could not get your IP address from your " \ |
| 490 | "DNS Server.") |
| 491 | self_ip = '127.0.0.1' |
| 492 | ips[ips.index(ip)] = self_ip |
| 493 | return ips |
| 494 | |
| 495 | |
| 496 | def __init__(self, file_): |