mirror of
https://github.com/huashengdun/webssh.git
synced 2026-08-20 12:46:39 +00:00
Added to_ip_address to utils
This commit is contained in:
+5
-2
@@ -30,10 +30,13 @@ def to_int(string):
|
||||
pass
|
||||
|
||||
|
||||
def to_ip_address(ipstr):
|
||||
return ipaddress.ip_address(to_str(ipstr))
|
||||
|
||||
|
||||
def is_valid_ip_address(ipstr):
|
||||
ipstr = to_str(ipstr)
|
||||
try:
|
||||
ipaddress.ip_address(ipstr)
|
||||
to_ip_address(ipstr)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user