Force-Framework

Mark Brennand

IPHelperV1

global with sharing class IPHelperV1
Description

Helper methods for IP address operations.

Copyright (c) 2025 Mark Brennand, released under MIT License.

AuthorMark Brennand

Methods

  getAddress

global static Address getAddress(final String ipAddress)
Description

Builds an Address representation of the given IP address string.

ParameteripAddress: The IP address.
ReturnsThe Address representation.

IPHelperV1.APIException

global with sharing class APIException extends Exception
Description

Exception thrown on failure in API.

IPHelperV1.Address

global interface Address
Description

API representation of an IP address.

Methods

  isAllowed

Boolean isAllowed(final String cidr)
Description

Check whether address conforms to given CIDR value.

Parametercidr: The CIDR value to be checked against.
ReturnsTrue if address matches CIDR, false if not.