How to check client_ip ipv4 or ipv6?

Not convinced a length check will work. What about :: or ::1, which are valid V6 addresses but short? Perhaps check

if [client_ip] =~ /:/

V6 addresses are delimited using colon, V4 addresses using a period.

1 Like