mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e313bc3707 |
@@ -36,12 +36,11 @@ class DNS:
|
|||||||
cmd = "ip a | grep inet6 | grep 'scope global' | sed -e 's#/64 scope global##' | sed -e 's#inet6##'"
|
cmd = "ip a | grep inet6 | grep 'scope global' | sed -e 's#/64 scope global##' | sed -e 's#inet6##'"
|
||||||
return self.shell(cmd).strip()
|
return self.shell(cmd).strip()
|
||||||
|
|
||||||
def get(self, typ: str, domain: str) -> Optional[str]:
|
def get(self, typ: str, domain: str) -> str:
|
||||||
"""Get a DNS entry"""
|
"""Get a DNS entry or empty string if there is none."""
|
||||||
dig_result = self.shell(f"dig -r -q {domain} -t {typ} +short")
|
dig_result = self.shell(f"dig -r -q {domain} -t {typ} +short")
|
||||||
line = dig_result.partition("\n")[0]
|
line = dig_result.partition("\n")[0]
|
||||||
if line:
|
return line
|
||||||
return line
|
|
||||||
|
|
||||||
def check_ptr_record(self, ip: str, mail_domain) -> bool:
|
def check_ptr_record(self, ip: str, mail_domain) -> bool:
|
||||||
"""Check the PTR record for an IPv4 or IPv6 address."""
|
"""Check the PTR record for an IPv4 or IPv6 address."""
|
||||||
|
|||||||
Reference in New Issue
Block a user