Skip to main content

@terascope/ip-utils / utils/ip-range / IPRange

Class: IPRange

Defined in: utils/ip-range.ts:4

Properties

PropertyModifierTypeDefined in
maxValuereadonlyIPAddressutils/ip-range.ts:6
minValuereadonlyIPAddressutils/ip-range.ts:5
versionreadonly4 | 6utils/ip-range.ts:7

Methods

contains()

contains(input): boolean

Defined in: utils/ip-range.ts:46

Returns true if the given IP address falls within this range (inclusive). The IP version must match the range version exactly.

Parameters

ParameterType
inputstring | IPAddress

Returns

boolean


containsCIDR()

containsCIDR(cidr): boolean

Defined in: utils/ip-range.ts:64

Returns true if the given CIDR block is fully contained within this range. Both the CIDR's network address (first) and broadcast address (last) must fall within [minValue, maxValue]. This ensures exclusive range bounds are respected for the entire CIDR, not just the usable host addresses.

Parameters

ParameterType
cidrCIDRBlock

Returns

boolean


toString()

toString(): string

Defined in: utils/ip-range.ts:38

Returns

string


from()

static from(min, max): IPRange

Defined in: utils/ip-range.ts:21

Build an IPRange from two IPAddress boundary values (inclusive). Both must be the same IP version and min must be <= max.

Parameters

ParameterType
minIPAddress
maxIPAddress

Returns

IPRange