资 源 简 介
scala-ipv4 is a Scala library for IPv4 related concepts such as IP addresses, network masks, address pools, etc.
Key Concepts
IpAddress
IpAddress represents an IPv4 address.
val address = new IpAddress("192.168.0.1")
IpAddress can be used to make calculations on IP addresses, such as finding the next address.
val address = new IpAddress("192.168.0.1")val next = address + 1println(next == new IpAddress("192.168.0.2")) // prints true
IpAddressRange
IpAddressRange represents a continuous range of consecutive addresses.
val range = new IpAddressRange(new IpAddress("192.168.0.1"), new IpAddress("192.168.0.5"))println(range.contains(new IpAddress("192.168.0.3")) // prints true
IpNetworkMask
IpNetworkMask represents a network mask, to be used in an IpNetwork.
```
val mask1 = new IpN