mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 04:52:03 -08:00
Small performance boost on ip validation with caching
This commit is contained in:
parent
e1fc678719
commit
b5a248707e
1 changed files with 2 additions and 0 deletions
|
|
@ -62,10 +62,12 @@ class Proxy:
|
|||
}
|
||||
|
||||
|
||||
@lru_cache(128, typed=True)
|
||||
def valid_ipv4(ip: str) -> bool:
|
||||
return bool(re.match(r'^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$', ip))
|
||||
|
||||
|
||||
@lru_cache(128, typed=True)
|
||||
def valid_ipv6(ip: str) -> bool:
|
||||
return bool(re.match(r'^(([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4})$', ip))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue