-
Notifications
You must be signed in to change notification settings - Fork 0
core
The core module provided a basic tools to handle IP and Mac addresses validation, defining a networks, getting local network interfaces information and more.
Global that present the two IP version
used to check if a giving string address is a valid Ipv4 or Ipv6 address
V4V6
-
is_v4- Description: checks if a giving address is a valid Ipv4 address
-
Arguments: address -
string -
Returns: boolean ,
trueif valid Ipv4,falseotherwise
-
is_v6-- Description: checks if a giving address is a valid Ipv6 address
-
Arguments: address -
string -
Returns: boolean ,
trueif valid Ipv6,falseotherwise
Global that present the varies kinds of IP address.
used to check if a giving address is from specific kind of address or get the type of the address.
PublicPrivateLoopbackLinkLocalApipaUniqeLocalUniqeGlobalBroadcastNetidMulticastUnspecified
-
is_public-
Description: checks if a giving address is a public Ipv4 address
-
Arguments: address -
string -
Returns:
boolean,trueif public,falseotherwise
-
-
is_private-
Description: checks if a giving address is a private Ipv4 address
-
Arguments: address -
string -
Returns:
boolean,trueif private,falseotherwise
-
-
is_loopback-
Description: checks if a giving address is a loopback Ipv4 address
-
Arguments: address -
string -
Returns:
boolean,trueif loopback,falseotherwise
-
-
is_linklocal-
Description: checks if a giving address is a linklocal Ipv6 address
-
Arguments: address -
string -
Returns:
boolean,trueif linklocal,falseotherwise
-
-
is_apipa-
Description: checks if a giving address is an apipa Ipv4 address
-
Arguments: address -
string -
Returns:
boolean,trueif apipa,falseotherwise
-
-
is_multicast-
Description: checks if a giving address is a multicast address
-
Arguments: address -
string -
Returns:
boolean,trueif multicast,falseotherwise
-
-
is_unspecified-
Description: checks if a giving address is a unspecified address
-
Arguments: address -
string -
Returns:
boolean,trueif unspecified,falseotherwise
-
-
is_broadcast-
Description: checks if a giving address is a broadcast address
-
Arguments:
- address -
string, - mask -
Mask
- address -
-
Returns:
boolean,trueif is valid broadcast address in the mask range,falseotherwise
-
-
is_netid-
Description: checks if a giving address is a net id
-
Arguments:
- address -
string, - mask -
Mask
- address -
-
Returns:
boolean,trueif is a net id in the mask range,falseotherwise
-
-
get_kind-
Description: gets the type of a giving address if valid
-
Arguments: address -
string -
Returns:
IpKindmember if valid address otherwiseBadArgumenterror would be raised
-
-
get_broadcast-
Description: gets broadcast by a giving net id and a mask
-
Arguments:
- address -
string, - mask -
Mask
- address -
-
Returns:
IpAddressif valid net id otherwiseBadArgumenterror would be raised
-
Global that present an IP address userdata.
- address -
string - version -
IpVersion - kind -
IpKind
-
get_octets-
Description: get the octets of the address
-
Arguments:
self -
Returns:
table
-
-
get_expended-
Description: expends a giving Ipv6 address
-
Arguments:
self -
Returns:
string
-
-
new-
Description: creates a new
IpAddressinstance -
Arguments: address -
string -
Returns:
IpAddressif valid address otherwiseBadArgumenterror would be raised
-
-
is_valid-
Description: checks if a giving address is a valid IP address
-
Arguments: address -
string -
Returns:
boolean,trueif valid,falseotherwise
-
-
expend-
Description: expends a giving Ipv6 address
-
Arguments: address -
string -
Returns:
stringif valid address otherwiseBadArgumenterror would be raised
-
-
shorten-
Description: shorten a giving Ipv6 address
-
Arguments: address -
string -
Returns:
stringif valid address otherwiseBadArgumenterror would be raised
-
-
eui64-
Description: creates a linklocal address from a giving mac using the eui64 algorithm
-
Arguments: mac -
MacAddress -
Returns:
IpAddress
-
Global that present a network mask userdata.
- mask -
string - prefix -
number - num_of_hosts -
number
-
new-
Description: creates a new
Maskinstance -
Arguments: mask -
string -
Returns:
Maskif valid mask otherwiseBadArgumenterror would be raised
-
-
is_valid-
Description: checks if a giving mask is a valid network mask
-
Arguments: mask -
string -
Returns:
boolean,trueif valid,falseotherwise
-
-
from_prefix-
Description: creates a new
Maskinstance from a giving mask prefix -
Arguments: prefix -
number -
Returns:
Maskif valid prefix otherwiseBadArgumenterror would be raised
-
-
get_prefix-
Description: gets the mask prefix from a giving mask
-
Arguments: mask -
string -
Returns:
numberif valid mask otherwiseBadArgumenterror would be raised
-
Global that present a IP network userdata.
- broadcast -
IpAddress - netid -
IpAddress - mask -
Mask
-
contains-
Description: check if a giving
IpAddressis part of the network -
Arguments:
self- address -
IpAddress
-
Returns:
boolean, true if is part of the network false otherwise
-
-
contains_str-
Description: expends a giving Ipv6 address
-
Arguments:
self- address -
string
-
Returns:
boolean, true if is part of the network false otherwise
-
-
new-
Description: creates a new
Networkinstance -
Arguments:
- netid -
IpAddress - mask -
Mask
- netid -
-
Returns:
Networkif valid net id with the mask range otherwiseBadArgumenterror would be raised
-
-
from-
Description: creates a new
Networkinstance from string{net_id}/{prefix}format -
Arguments: net -
string -
Returns:
Networkif valid net id with the prefix range and in the{net_id}/{prefix}format otherwiseBadArgumenterror would be raised
-
Global that present a mac address userdata.
- address -
string
-
as_array-
Description: get the parts of the mac address
-
Arguments:
self -
Returns:
table
-
-
as_bytes-
Description: get the parts of the mac address as bytes
-
Arguments:
self -
Returns:
table
-
-
new-
Description: creates a new
MacAddressinstance -
Arguments: mac -
string -
Returns:
MacAddressif valid mac otherwiseBadArgumenterror would be raised
-
-
is_valid-
Description: checks if a giving mac address is a valid
-
Arguments: mac -
string -
Returns:
boolean,trueif valid,falseotherwise
-
-
==,>,>=,<,<=
can be used to compare between to giving MacAddresss
- name -
string - index -
number - description -
string - mac -
MacAddress - ipv4 -
IpAddress - ipv6 -
IpAddress - mask -
Mask
-
by_index-
Description: creates a new
Interfaceinstance as the local machine network interface with the giving index -
Arguments: index -
number -
Returns:
Interfaceif valid index otherwiseBadArgumenterror would be raised
-
-
by_name-
Description: creates a new
Interfaceinstance as the local machine network interface with the giving name -
Arguments: name -
string -
Returns:
Interfaceif valid name otherwiseBadArgumenterror would be raised
-
-
all-
Description: gets a
Interfaceinstances array as all the local machine network interfaces -
Returns:
Table
-