net

package
v1.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package net implements a set of net types that are extensions to the built-in net package. The extensions provide additional function such as JSON marshaling and unmarshaling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCIDR

func ParseCIDR(c string) (*IP, *IPNet, error)

Types

type IP

type IP struct {
	net.IP
}

Sub class net.IP so that we can add JSON marshalling and unmarshalling.

func (IP) MarshalJSON

func (i IP) MarshalJSON() ([]byte, error)

MarshalJSON interface for an IP

func (*IP) UnmarshalJSON

func (i *IP) UnmarshalJSON(b []byte) error

UnmarshalJSON interface for an IP

func (IP) Version

func (i IP) Version() int

Version returns the IP version for an IP

type IPNet

type IPNet struct {
	net.IPNet
}

Sub class net.IPNet so that we can add JSON marshalling and unmarshalling.

func (IPNet) MarshalJSON

func (i IPNet) MarshalJSON() ([]byte, error)

MarshalJSON interface for an IPNet

func (IPNet) String

func (i IPNet) String() string

String returns a friendly name for the network. The standard net package implements String() on the pointer, which means it will not be invoked on a struct type, so we re-implement on the struct type.

func (*IPNet) UnmarshalJSON

func (i *IPNet) UnmarshalJSON(b []byte) error

UnmarshalJSON interface for an IPNet

func (*IPNet) Version

func (i *IPNet) Version() int

Version returns the IP version for an IPNet

type MAC

type MAC struct {
	net.HardwareAddr
}

Sub class net.HardwareAddr so that we can add JSON marshalling and unmarshalling.

func (MAC) MarshalJSON

func (m MAC) MarshalJSON() ([]byte, error)

MarshalJSON interface for a MAC

func (*MAC) UnmarshalJSON

func (m *MAC) UnmarshalJSON(b []byte) error

UnmarshalJSON interface for a MAC

Jump to

Keyboard shortcuts

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