PHP Class Vectorface\Whip\IpRange\Ipv6Range

Author: Daniel Bruce ([email protected])
Inheritance: implements Vectorface\Whip\IpRange\IpRange
Show file Open project: vectorface/whip

Public Methods

Method Description
__construct ( string $range ) Constructor for the class.
containsIp ( string $ipAddress ) : boolean Returns whether or not a given IP address falls within this range.

Private Methods

Method Description
convertToBinaryString ( string $address ) : string Converts an IPv6 address to a binary string.
extractNetworkAndMaskFromRange ( string $range ) Extracts the mask and binary string substring of the range to compare against incoming IP addresses.
hexToBinary ( string $hex ) : string Converts a hexadecimal character to a 4-digit binary string.

Method Details

__construct() public method

Constructor for the class.
public __construct ( string $range )
$range string The IPv6 range as a string. Supported range styles: - CIDR notation (2400:cb00::/32) - a specific IP address (::1)

containsIp() public method

Returns whether or not a given IP address falls within this range.
public containsIp ( string $ipAddress ) : boolean
$ipAddress string The given IP address.
return boolean Returns true if the IP address falls within the range and false otherwise.