nethelper

package
v0.0.0-...-174afc0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

This is an adaptation of below gist:

https://gist.github.com/kotakanbe/d3059af990252ba89a82

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CIDRSubnet

func CIDRSubnet(cidr string) (string, error)

CIDRSubnet will return the IPMask in decimal format e.g. 192.0.2.1/24 will return ("24", nil)

func GetAvailableIPs

func GetAvailableIPs(cidr string, reqdCount int) ([]string, error)

GetAvailableIPs provides IPs that are available in the passed cidr network address range.

The parameter `reqdCount` specifies the number of IP addresses to be returned.

TODO IMPORTANT Check if these channels leak ? Do we need to close them ?

func IPs

func IPs(cidr string) ([]string, error)

IPs accepts a network address in CIDR notation and returns a list of IP address.

NOTE:

The returned list removes the network & broadcast addresses

func IsCIDR

func IsCIDR(cidr string) bool

IsCIDR validates if passed argument i.e. cidr is actually in CIDR format

Types

type Pong

type Pong struct {
	Ip    string
	Alive bool
}

Jump to

Keyboard shortcuts

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