iputil

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: MIT Imports: 3 Imported by: 0

README

Build Status codecov GoDoc

iputil

go library for IP address manipulation

Documentation

Overview

Package iputil contains helper functions for IPv4 address manipulations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstAdr

func FirstAdr(subnet *net.IPNet) uint32

FirstAdr returns first IP address from a given subnet in uint32 format

func IPMaskToString added in v0.2.2

func IPMaskToString(mask *net.IPMask) string

IPMaskToString converts giver IPMask to dotted decimal format or returns nil for non-IPv4 masks

func IPToUint32

func IPToUint32(ip *net.IP) uint32

IPToUint32 converts IPv4 address from net.IP to uint32 format

func IncrIP added in v0.2.0

func IncrIP(ip *net.IP, offset uint32) *net.IP

IncrIP returns given IP address increased by given offset

func IsIPv4

func IsIPv4(ip *net.IP) bool

IsIPv4 checks whether given ip address is IPv4

func IsIPv4Net added in v0.2.0

func IsIPv4Net(ipnet *net.IPNet) bool

IsIPv4Net checks whether given ip network address is IPv4

func LastAdr

func LastAdr(subnet *net.IPNet) uint32

LastAdr returns first IP address from a given subnet in uint64 format

func NumAdr

func NumAdr(subnet *net.IPNet) uint64

NumAdr returns number of IPv4 addresses in a given subnet or zero if not IPv4

func Overlap

func Overlap(subnet1, subnet2 *net.IPNet) bool

Overlap checks whether two given subnets overlaps

func Uint32ToIP

func Uint32ToIP(adr uint32) *net.IP

Uint32ToIP converts IPv4 address from uint32 to net.IP format

Types

This section is empty.

Jump to

Keyboard shortcuts

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