validators 0.25.3

This library is designed for validating and modeling user input. The crate includes models, functions, traits, errors, and other dependencies.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::net::IpAddr;

use crate::functions::{is_local_ipv4, is_local_ipv6};

/// Determine whether the input `IpAddr` is local.
#[inline]
pub const fn is_local_ip(addr: IpAddr) -> bool {
    match addr {
        IpAddr::V4(addr) => is_local_ipv4(addr),
        IpAddr::V6(addr) => is_local_ipv6(addr),
    }
}