mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-06-14 12:06:06 +00:00
dyndns: accept and validate both A and AAAA records; default to client address
This commit is contained in:
@ -2,6 +2,7 @@ import re
|
||||
import json
|
||||
import requests
|
||||
import hashlib
|
||||
import ipaddress
|
||||
|
||||
from app import app
|
||||
from distutils.version import StrictVersion
|
||||
@ -291,3 +292,14 @@ def display_setting_state(value):
|
||||
return "OFF"
|
||||
else:
|
||||
return "UNKNOWN"
|
||||
|
||||
|
||||
def validate_ipaddress(address):
|
||||
try:
|
||||
ip = ipaddress.ip_address(address)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
if isinstance(ip, (ipaddress.IPv4Address, ipaddress.IPv6Address)):
|
||||
return [ip]
|
||||
return []
|
||||
|
Reference in New Issue
Block a user