is-ip
Check if a string is an IP address
Install
[]
= "0.1.0"
Usage
use ;
is_ip;
//=> true
is_ip;
//=> true
is_ipv4;
//=> false
API
is_ip(string: &str) -> bool
Check if string is IPv6 or IPv4.
is_ipv4(string: &str) -> bool
Check if string is IPv4.
is_ipv6(string: &str) -> bool
Check if string is IPv6.
ip_version(string: &str) -> Option<u8>
Returns Some(6) if string is IPv6, Some(4) if string is IPv4, or None if string is neither.
use ip_version;
ip_version;
//=> Some(6)
ip_version;
//=> Some(4)
ip_version;
//=> None
This lib inspired by is-ip a nodejs package!