wgconf

package
v0.0.0-...-406ed4b Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaskedIP

type MaskedIP struct {
	IP   net.IP
	Mask net.IPMask
}
Example
in := []string{
	"192.168.1.1/24",
	"10.8.0.1/24",
	"127.0.0.1/32",
}

for _, str := range in {
	addr, _ := ParseCIDR(str)

	// replace all masks
	addr.Mask = net.IPv4Mask(255, 255, 0, 0)
	fmt.Println(addr.String())
}
Output:

192.168.1.1/16
10.8.0.1/16
127.0.0.1/16

func ParseCIDR

func ParseCIDR(cidr string) (MaskedIP, error)

func (*MaskedIP) String

func (addr *MaskedIP) String() string

Jump to

Keyboard shortcuts

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