xnet

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRouteNotFound = errors.New("route not found")

Functions

func GetExternalIPv4Addr added in v0.3.5

func GetExternalIPv4Addr() (net.IP, error)

func GetOutboundAddr added in v0.3.5

func GetOutboundAddr() (net.IP, error)

Get preferred outbound ip of this machine

func IsPrivateIPNet added in v0.2.8

func IsPrivateIPNet(ipn *net.IPNet) bool

func ParseCIDR

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

Types

type IP

type IP struct {
	IP net.IP
}

func ParseIP

func ParseIP(s string) IP

func Uint32ToIP

func Uint32ToIP(n uint32) IP

func (IP) Equal

func (ip IP) Equal(other IP) bool

func (IP) Isv4

func (ip IP) Isv4() bool

func (*IP) Scan

func (ip *IP) Scan(src interface{}) error

func (IP) String

func (ip IP) String() string

func (*IP) ToUint32

func (ip *IP) ToUint32() uint32

func (*IP) Value

func (ip *IP) Value() (driver.Value, error)

type IPMask

type IPMask struct {
	IPMask net.IPMask
}

func (*IPMask) Size

func (mask *IPMask) Size() (ones, bits int)

func (*IPMask) ToUint32

func (mask *IPMask) ToUint32() uint32

type IPNet

type IPNet struct {
	IPNet net.IPNet
}

func (*IPNet) BroadcastAddr

func (net *IPNet) BroadcastAddr() IP

func (*IPNet) FirstUsable

func (net *IPNet) FirstUsable() IP

func (*IPNet) IP

func (net *IPNet) IP() *IP

func (*IPNet) LastUsable

func (net *IPNet) LastUsable() IP

func (*IPNet) Mask

func (net *IPNet) Mask() *IPMask

func (*IPNet) NetworkAddr

func (net *IPNet) NetworkAddr() IP

func (*IPNet) String

func (net *IPNet) String() string

Jump to

Keyboard shortcuts

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