diff options
| -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 |
