WordPress at a glance
function is not described

rest_is_ip_address() WP 4.7.0

Determines if an IP address is valid.

Handles both IPv4 and IPv6 addresses.

No Hooks.

Return

String/false. The valid IP address, otherwise false.

Usage

rest_is_ip_address( $ip );
$ip(string) (required)
IP address.

Code of rest is ip address: wp-includes/rest-api.php VER 5.1.1

<?php
function rest_is_ip_address( $ip ) {
	$ipv4_pattern = '/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/';

	if ( ! preg_match( $ipv4_pattern, $ip ) && ! Requests_IPv6::check_ipv6( $ip ) ) {
		return false;
	}

	return $ip;
}