We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ab893d commit 6ce3ec4Copy full SHA for 6ce3ec4
pkg/core/core.go
@@ -11,13 +11,15 @@ func AddressCount(network *net.IPNet) uint64 {
11
if network.Mask != nil {
12
// Handle edge cases
13
switch prefixLen {
14
- case 32: return 1
15
- case 31: return 2
+ case 32:
+ return 1
16
+ case 31:
17
+ return 2
18
}
19
20
21
// Remember to subtract the network address and broadcast address
- return 1 << (uint64(bits) - uint64(prefixLen)) - 2
22
+ return 1<<(uint64(bits)-uint64(prefixLen)) - 2
23
24
25
func ParseCIDR(network string) (*net.IPNet, error) {
@@ -28,10 +30,6 @@ func ParseCIDR(network string) (*net.IPNet, error) {
28
30
return ip, err
29
31
32
-func ParseIP(ip string) net.IP {
- return net.ParseIP(ip)
33
-}
34
-
35
func ContainsAddress(network *net.IPNet, ip net.IP) bool {
36
return network.Contains(ip)
37
0 commit comments