package module
v0.9.0 Latest Latest

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

Go to latest
Published: Feb 10, 2018 License: MIT Imports: 11 Imported by: 122



GoDoc license Build Status

iprange is a library you can use to parse IPv4 addresses from a string in the nmap format.

It takes a string, and returns a list of Min-Max pairs, which can then be expanded and normalized automatically by the package.

Supported Formats

iprange supports the following formats:

  • 10.0.0.*
  •,, 192.168.1.*,


package main

import (


func main() {
	list, err := iprange.ParseList(",, 192.168.1.*,")
	if err != nil {
		log.Printf("error: %s", err)
	log.Printf("%+v", list)

	rng := list.Expand()
	log.Printf("%s", rng)




This section is empty.


This section is empty.


This section is empty.


type AddressRange

type AddressRange struct {
	Min net.IP
	Max net.IP

func Parse

func Parse(in string) (*AddressRange, error)

Parse takes a single target specification and returns a range. It effectively calls ParseList and returns the first result

func (*AddressRange) Expand

func (r *AddressRange) Expand() []net.IP

Expand expands an address with a mask taken from a stream

type AddressRangeList

type AddressRangeList []AddressRange

func ParseList

func ParseList(in string) (AddressRangeList, error)

ParseList takes a list of target specifications and returns a list of ranges, even if the list contains a single element.

func (AddressRangeList) Expand

func (l AddressRangeList) Expand() []net.IP

Expand expands and normalizes a set of parsed target specifications

Jump to

Keyboard shortcuts

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