From 7e2919a59d6d80bd7a4b2fc93a14d52a552c344c Mon Sep 17 00:00:00 2001
From: Evan Pratten <evan@ewpratten.com>
Date: Fri, 13 Oct 2023 13:43:39 -0400
Subject: [PATCH] ttl

---
 configs/scripts/wg-genzone.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/configs/scripts/wg-genzone.py b/configs/scripts/wg-genzone.py
index c731010..7a3e9be 100755
--- a/configs/scripts/wg-genzone.py
+++ b/configs/scripts/wg-genzone.py
@@ -103,6 +103,7 @@ def main() -> int:
     ap.add_argument(
         "--no-sudo", action="store_true", help="Do not use sudo to execute wg-quick"
     )
+    ap.add_argument("--ttl", help="The TTL to use for the zone", default=60)
     args = ap.parse_args()
 
     # Read the interface config
@@ -115,7 +116,6 @@ def main() -> int:
     
     # Convert to a zone file
     print(f"$ORIGIN {args.zone}.")
-    print(f"$TTL 60")
     print(f"@ IN SOA ns.{args.zone}. noc.ewpratten.com. 1 3600 600 86400 60")
     
     # Add the hosts
@@ -129,11 +129,11 @@ def main() -> int:
         # Add forward and reverse records
         for address in addresses:
             if isinstance(address, ipaddress.IPv4Address):
-                print(f"{host}. IN A {address}.")
-                print(f"{address.reverse_pointer}. IN PTR {host}.")
+                print(f"{host}. {args.ttl} IN A {address}.")
+                print(f"{address.reverse_pointer}. {args.ttl} IN PTR {host}.")
             elif isinstance(address, ipaddress.IPv6Address):
-                print(f"{host}. IN AAAA {address}.")
-                print(f"{address.reverse_pointer}. IN PTR {host}.")
+                print(f"{host}. {args.ttl} IN AAAA {address}.")
+                print(f"{address.reverse_pointer}. {args.ttl} IN PTR {host}.")
     
     
     return 0