Anonymous user
Module:IP/doc: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add IPv4Collection:addSubnet
(start documenting the IPv4Collection class) |
(add IPv4Collection:addSubnet) |
||
Line 1:
Module:IP is a library for working with IP addresses and subnets. It can handle both [[IPv4]] and [[IPv6]]. The library exports four classes, [[#IPAddress|IPAddress]], [[#Subnet|Subnet]], [[#IPv4Collection|IPv4Collection]], and [[#IPv6Collection|IPv6Collection]].
== Loading the library ==
Line 409:
collection:addIP('1.2.3.4')
collection:addIP(IPAddress.new('1.2.3.4'))
</source>
=== addSubnet ===
<source lang="lua">
collection:addIP(ip)
</source>
Adds a subnet to the collection. The subnet can be either a [[CIDR]] string or a [[#Subnet|Subnet]] object.
Examples:
<source lang="lua">
collection:addSubnet('1.2.3.0/24')
collection:addSubnet(Subnet.new('1.2.3.0/24'))
</source>
|