iputil

package
v0.0.0-...-b7b5849 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package iputil provides utilities for IPv4/IPv6 related utils

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateIPs

func GenerateIPs(ipBlock string, n int) []string

GenerateIPs creates list of n IPs using ipBlock

func GenerateIPsWithStep

func GenerateIPsWithStep(startIP string, count int, stepIP string) ([]string, error)

GenerateIPsWithStep creates a list of IPv4 addresses. Returns a slice of IPv4 address strings or an error if inputs are invalid.

func GenerateIPv6s

func GenerateIPv6s(baseIP net.IP, n int) ([]string, error)

GenerateIPv6s generates a list of consecutive IPv6 addresses starting from a given base IP.

func GenerateIPv6sWithStep

func GenerateIPv6sWithStep(startIP string, count int, stepIP string) ([]string, error)

GenerateIPv6sWithStep creates a list of IPv6 addresses. Returns a slice of IPv6 address strings or an error if inputs are invalid.

func GenerateMACs

func GenerateMACs(startMAC string, count int, stepMACStr string) []string

GenerateMACs returns a slice of MAC address strings. Returns generated MAC addresses or an empty slice on parse errors.

func IPEqual

func IPEqual(got, want string) bool

IPEqual compares two strings by parsing them as IP addresses for semantic equality. If parsing fails for either, it falls back to a standard direct string comparison.

func IncrementMAC

func IncrementMAC(startMAC string, i int) (string, error)

IncrementMAC increments the given MAC address by `i` and returns the result. This is just a convenience wrapper around GenerateMACs.

func NextIPMultiSteps

func NextIPMultiSteps(ip net.IP, count int) net.IP

NextIPMultiSteps returns the next IPv4 or IPv6 address after incrementing the last octet by count times.

Types

This section is empty.

Jump to

Keyboard shortcuts

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