netutil

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package netutil provides network utility functions for CIDR and IP address operations. It is primarily used for Aquanaut's IPAM functionality to handle CIDR overlap detection and boundary calculations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CIDROverlaps

func CIDROverlaps(cidr1, cidr2 string) bool

CIDROverlaps checks if two CIDRs overlap. This function properly detects cases where the network addresses don't contain each other, but the CIDR ranges still overlap.

Parameters: - cidr1, cidr2: The two CIDRs to check for overlap

Returns: - true if the CIDRs overlap, false otherwise - If either CIDR is invalid, returns false - If the CIDRs are from different address families (IPv4 vs IPv6), returns false

func CalculateLastIP

func CalculateLastIP(network *net.IPNet) net.IP

CalculateLastIP calculates the last IP address in a network. This is used to check for partial CIDR overlaps and boundary conditions.

Parameters: - network: The network to calculate the last IP for

Returns: - The last IP address in the network

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL