Help us shape the future of Go! Take the 2026 Go Developer Survey

ipv4utils

package module
v0.0.0-...-48b71a0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: MIT Imports: 2 Imported by: 0

README

ipv4utils

Golang package for IPv4 utilities, namely merging IPv4 addresses for numerical operations, splitting them again and subnetting.

Documentation

Overview

Package ipv4utils provides utilities for working with IPv4 addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(ip []byte) (merged uint32, err error)

Merge merges an IP to a value.

Merging an IP allows for the use of operations on the IP.

func Split

func Split(merged uint32) []byte

Split splits a value into an IP.

After merging an IP to perform operations on it, Split can be used to put the IP back into a slice.

func Subnet

func Subnet(network net.IPNet, bits uint) (subnets chan net.IPNet, err error)

Subnet subnets a network with the provided amount of bits.

The network IP may have host bits set, as long as this address is a valid network address within the new subnet mask.

This means that you can provide an offset for subnetting through the network IP:

Network IP: 192.168.1.128/24, bits: 1 -> First subnet is 192.168.1.128/25, not 192.168.1.0/25

The channel to provide the subnets is unbuffered and closed once subnetting is completed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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