ip

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NativeEndian binary.ByteOrder

NativeEndian is the ByteOrder of the current system.

Functions

func DisableForwardingForInterface added in v0.14.0

func DisableForwardingForInterface(iface *net.Interface) error

DisableForwardingForInterface disables forwarding for given interface. The process must run with elevated rights. Otherwise the function will fail with an "Access Denied" error.

func EnableForwardingForInterface added in v0.14.0

func EnableForwardingForInterface(iface *net.Interface) error

EnableForwardingForInterface enables forwarding for given interface. The process must run with elevated rights. Otherwise the function will fail with an "Access Denied" error.

func GetDefaultGatewayInterface added in v0.14.0

func GetDefaultGatewayInterface() (*net.Interface, error)

GetDefaultGatewayInterface returns the first network interface found with a default gateway set

func GetInterfaceByIP

func GetInterfaceByIP(search net.IP) (*net.Interface, error)

GetInterfaceByIP tries to get the network interface with the given ip address

func GetInterfaceIP4Addr added in v0.14.0

func GetInterfaceIP4Addr(iface *net.Interface) (net.IP, error)

GetInterfaceIP4Addr returns the IPv4 address for the given network interface

func IsForwardingEnabledForInterface added in v0.14.0

func IsForwardingEnabledForInterface(iface *net.Interface) (bool, error)

func NativelyLittle

func NativelyLittle() bool

Types

type IP4

type IP4 uint32

func FromBytes

func FromBytes(ip []byte) IP4

func FromIP

func FromIP(ip net.IP) IP4

func MustParseIP4 added in v0.5.6

func MustParseIP4(s string) IP4

func ParseIP4

func ParseIP4(s string) (IP4, error)

func (IP4) MarshalJSON

func (ip IP4) MarshalJSON() ([]byte, error)

MarshalJSON: json.Marshaler impl

func (IP4) NetworkOrder

func (ip IP4) NetworkOrder() uint32

func (IP4) Octets

func (ip IP4) Octets() (a, b, c, d byte)

func (IP4) String

func (ip IP4) String() string

func (IP4) StringSep

func (ip IP4) StringSep(sep string) string

func (IP4) ToIP

func (ip IP4) ToIP() net.IP

func (*IP4) UnmarshalJSON

func (ip *IP4) UnmarshalJSON(j []byte) error

UnmarshalJSON: json.Unmarshaler impl

type IP4Net

type IP4Net struct {
	IP        IP4
	PrefixLen uint
}

similar to net.IPNet but has uint based representation

func FromIPNet

func FromIPNet(n *net.IPNet) IP4Net

func (IP4Net) Contains

func (n IP4Net) Contains(ip IP4) bool

func (IP4Net) Empty added in v0.8.0

func (n IP4Net) Empty() bool

func (IP4Net) Equal

func (n IP4Net) Equal(other IP4Net) bool

func (IP4Net) MarshalJSON

func (n IP4Net) MarshalJSON() ([]byte, error)

MarshalJSON: json.Marshaler impl

func (IP4Net) Mask

func (n IP4Net) Mask() uint32

func (IP4Net) Network

func (n IP4Net) Network() IP4Net

func (IP4Net) Next

func (n IP4Net) Next() IP4Net

func (IP4Net) Overlaps

func (n IP4Net) Overlaps(other IP4Net) bool

func (IP4Net) String

func (n IP4Net) String() string

func (IP4Net) StringSep

func (n IP4Net) StringSep(octetSep, prefixSep string) string

func (IP4Net) ToIPNet

func (n IP4Net) ToIPNet() *net.IPNet

func (*IP4Net) UnmarshalJSON

func (n *IP4Net) UnmarshalJSON(j []byte) error

UnmarshalJSON: json.Unmarshaler impl

Jump to

Keyboard shortcuts

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