ipv4util

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IP_SPLIT          = "." // IP_SPLIT use split the ip v4 address.
	IP_SPLIT_TAG      = "-" // IP_SPLIT_TAG use to split the ip v4 interval
	IP_MASK_SPLIT_TAG = "/" // IP_MASK_SPLIT_TAG use to split subnet ip and mask bit
	MAX_MASK_BIT      = 32  // MAX_MASK_BIT the maximum value of the mask bit
)

Variables

This section is empty.

Functions

func GetMaskByMaskBit

func GetMaskByMaskBit(maskBit int) string

GetMaskByMaskBit Get the mask by the mask bit.

func GetMaskI64ByMaskBit

func GetMaskI64ByMaskBit(maskBit int) int64

GetMaskI64ByMaskBit Gets the subnet mask in integer form by mask bit.

func IPv4ToInt64

func IPv4ToInt64(ip string) (int64, error)

IPv4ToInt64 The ip convert to int64

func Int64ToIPv4

func Int64ToIPv4(ip int64) string

Int64ToIPv4 The integer ip convert to a string

func IsIPv4

func IsIPv4(ip string) bool

IsIPv4 Check whether the string is ipv4.

func List

func List(ipRange string, isAll bool) ([]string, error)

List get the ipv4 address set. ipRange is the ip segment. The format is 'x.x.x.x-x.x.x.x' or 'x.x.x.x/maskbit' isAll use 'x.x.x.x/maskbit'.It's true if you want to get all ip in network segment.Otherwise, it's false

Types

This section is empty.

Jump to

Keyboard shortcuts

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