From a4949e5694b9ffb8b8e11e89ca8cceb26555d479 Mon Sep 17 00:00:00 2001 From: steering7253 Date: Wed, 8 Apr 2026 16:43:45 +0000 Subject: update endpoint regex - allow dns --- autopeer_shell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'autopeer_shell.py') diff --git a/autopeer_shell.py b/autopeer_shell.py index 6b31ecb..abb4100 100755 --- a/autopeer_shell.py +++ b/autopeer_shell.py @@ -92,7 +92,8 @@ class AutopeerShell(cmd.Cmd): if not re.match(PUBKEY_REGEX, pubkey): print(f'Error: pubkey must match {PUBKEY_REGEX}', file=sys.stderr) return - ENDPOINT_REGEX = r'^([0-9.]+|[0-9a-fA-F:]+)$' + ENDPOINT_REGEX = r'^((?#IPv4)[0-9.]+|(?#IPv6)[0-9a-fA-F:]+|(?#DNS)(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))$' + # (([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]) via https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address if not re.match(ENDPOINT_REGEX, endpoint): print(f'Error: wg address must match {ENDPOINT_REGEX}', file=sys.stderr) return -- cgit v1.3.1-10-gc9f91