mergeips

package module
v0.0.0-...-cd4f2e8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 7 Imported by: 0

README

# mergeips image:https://godoc.org/github.com/Djarvur/go-mergeips?status.svg["GoDoc",link="http://godoc.org/github.com/Djarvur/go-mergeips"] image:https://travis-ci.org/Djarvur/go-mergeips.svg["Build Status",link="https://travis-ci.org/Djarvur/go-mergeips"] image:https://coveralls.io/repos/Djarvur/go-mergeips/badge.svg?branch=master&service=github["Coverage Status",link="https://coveralls.io/github/Djarvur/go-mergeips?branch=master"]

Golang library to merge IP ranges and subnets.

Documentation

Overview

Package mergeips provides a way to convert list of IP randes definitions, like individual IPs, CIDR subners and begin-end ranges to the minimal list of net IPNet

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInputInvalid = errors.New("invalid input")
)

Errors

Functions

func Merge

func Merge(nets []*net.IPNet) []*net.IPNet

Merge merges list of net.IPNet to the smallest possible set

func Parse

func Parse(s string, strict bool) ([]*net.IPNet, error)

Parse parses a string to net.IPNet String might be in 3 forms: ip address itself, in v4 or v6 notation CIDR subnet address, v4 or v6 IP adresses range, v4 or v6, in form begin-end If strict is false CIDR form subnet could be defined with not-a-first addrsss in the subnet. Otherwise the error will be returned

func Scan

func Scan(s Scanner) (res []*net.IPNet, err error)

Scan is used to parse source to the list of net.IPNet

Types

type Scanner

type Scanner interface {
	Scan() bool
	Text() string
	Err() error
}

Scanner is a simple interface to support Scan() function. Intentionnaly compatible with bufio.Scanner

Directories

Path Synopsis
internal
bigint
Package bigint comment should be of this form Package bigint comment should be of this form Package bigint comment should be of this form
Package bigint comment should be of this form Package bigint comment should be of this form Package bigint comment should be of this form
int128
Package int128 comment should be of this form
Package int128 comment should be of this form
masks
Package masks comment should be of this form
Package masks comment should be of this form
subnet
Package subnet comment should be of this form
Package subnet comment should be of this form
Package ipnet provides some useful methods to handle net.IPNet lists
Package ipnet provides some useful methods to handle net.IPNet lists
Package iprange is to havdle ipranges, like 1.1.1.1-2.2.2.2 IPv6 supported, of course
Package iprange is to havdle ipranges, like 1.1.1.1-2.2.2.2 IPv6 supported, of course

Jump to

Keyboard shortcuts

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