diff options
| author | 2026-04-08 16:43:45 +0000 | |
|---|---|---|
| committer | 2026-04-08 16:43:45 +0000 | |
| commit | a4949e5694b9ffb8b8e11e89ca8cceb26555d479 (patch) | |
| tree | 225f6686fade8b27e2faa2860ebfe9f3965b25a9 /autopeer_shell.py | |
| parent | misc fixes (diff) | |
update endpoint regex - allow dns
Diffstat (limited to 'autopeer_shell.py')
| -rwxr-xr-x | autopeer_shell.py | 3 |
1 files changed, 2 insertions, 1 deletions
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 |
