restrict-url-for-specific-ip-check
Reactive icon

Restrict URL for specific IP Check

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 15 November 2023
 by 
0.0
 (0 ratings)
restrict-url-for-specific-ip-check

Restrict URL for specific IP Check

Details
These functions collectively provide a set of utilities for working with IP addresses, subnet masks, and CIDR notation in the context of networking.
Read more

ipToBin

 - This function takes an IPv4 address as input.

 - It splits the IP address into octets using the dot as a delimiter.

 - Each octet is then converted to its binary representation (8 bits) using 

    Number(e).toString(2).padStart(8, '0').

 - The resulting binary representations are joined together, forming the complete binary representation of the IP address.


ipToLong

 - This function uses the ipToBin function to convert the IP address to its binary representation.

 - The binary representation is then converted to a decimal (base-10) number using parseInt(..., 2).

 - The result is an integer representing the long form of the IP address.


longToIp

 - This function takes a decimal number and converts it to its 32-bit binary representation.

 - The binary string is divided into four 8-bit segments.

 - Each segment is then converted back to decimal, and the resulting array is joined with dots to form the IPv4 address.


cidrToLong

 - This function takes a CIDR notation as input.

 - It generates a binary string with the first cidr bits set to '1' and the remaining bits set to '0'.

 - The binary string is then converted to a decimal (base-10) number using parseInt(..., 2).


getNetworkAddr

 - This function performs a bitwise AND operation between the IP address and the subnet mask.

 - The result is treated as an unsigned 32-bit integer.


getBroadcastAddr

 - This function performs a bitwise OR operation between the IP address and the bitwise NOT of the subnet mask.

 - The result is treated as an unsigned 32-bit integer.



inRange

 - This function checks if a given remoteIp falls within the subnet range specified by acceptIp and cidr (subnet mask length).


getClass


 - This function determines the class of an IP address (A, B, C, D, or E) based on its numeric representation.

Release notes (1.0.0)
License (1.0.0)
Reviews (0)
Team
Other assets in this category