From 76661a3e6c9344f8cedd0b751742228576fb278c Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Fri, 6 May 2022 15:31:12 +0200 Subject: [PATCH] Add comment Co-authored-by: Alexandre Aubin --- src/dns.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dns.py b/src/dns.py index d9108ce05..89d76f5f1 100644 --- a/src/dns.py +++ b/src/dns.py @@ -494,6 +494,12 @@ def _get_dns_zone_for_domain(domain): def _get_relative_name_for_dns_zone(domain, base_dns_zone): + # Strip the base dns zone name from a domain such that it's suitable for DNS manipulation relative to a defined zone + # For example, assuming base_dns_zone is "example.tld": + # example.tld -> @ + # foo.example.tld -> foo + # .foo.example.tld -> foo + # bar.foo.example.tld -> bar.foo return re.sub("\.?" + base_dns_zone.replace(".", "\.") + "$", "", domain.strip(".")) or "@"