mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Add generic ip address validation function
This commit is contained in:
parent
9f547205a0
commit
d1c2038081
@ -81,6 +81,14 @@ def ipv6_addr(addr):
|
||||
return __ip_addr(addr, socket.AF_INET6)
|
||||
|
||||
|
||||
def ip_addr(addr):
|
||||
'''
|
||||
Returns True if the IPv4 or IPv6 address (and optional subnet) are valid,
|
||||
otherwise returns False.
|
||||
'''
|
||||
return ipv4_addr(addr) or ipv6_addr(addr)
|
||||
|
||||
|
||||
def netmask(mask):
|
||||
'''
|
||||
Returns True if the value passed is a valid netmask, otherwise return False
|
||||
|
Loading…
Reference in New Issue
Block a user