network

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NetAnyIpv4 = net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)}
	NetAnyIpv6 = net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 128)}
	NetAny     = []net.IPNet{NetAnyIpv4, NetAnyIpv6}
)
View Source
var (
	PortRangeAny = PortRange{From: 1, To: 65534}
)

Functions

func GetLoopbackNetworkInterfaces added in v1.3.0

func GetLoopbackNetworkInterfaces() []string

func GetNetworkInterfaceIndexesByName added in v1.3.0

func GetNetworkInterfaceIndexesByName(names []string) []int

func GetNonLoopbackNetworkInterfaces added in v1.3.0

func GetNonLoopbackNetworkInterfaces() []string

func GetOwnIPs

func GetOwnIPs() []net.IP

func GetOwnNetworkInterfaces

func GetOwnNetworkInterfaces() []string

func IpToNet

func IpToNet(ip net.IP) *net.IPNet

func IpsToNets added in v1.2.0

func IpsToNets(ips []net.IP) []net.IPNet

func ParseCIDR added in v1.2.0

func ParseCIDR(s string) (*net.IPNet, error)

func ParseCIDRs added in v1.2.0

func ParseCIDRs(raw []string) ([]net.IPNet, []string)

Types

type NetWithPortRange

type NetWithPortRange struct {
	Net       net.IPNet
	PortRange PortRange
	Comment   string
}

func ComputeExcludesForOwnIpAndPorts added in v1.2.8

func ComputeExcludesForOwnIpAndPorts(port, healthPort uint16) []NetWithPortRange

func NewNetWithPortRanges

func NewNetWithPortRanges(nets []net.IPNet, portRanges ...PortRange) []NetWithPortRange

func (NetWithPortRange) Compare added in v1.2.9

func (nwp NetWithPortRange) Compare(b NetWithPortRange) int

func (NetWithPortRange) Contains added in v1.2.8

func (nwp NetWithPortRange) Contains(other NetWithPortRange) bool

func (NetWithPortRange) Merge added in v1.3.0

func (NetWithPortRange) Overlap added in v1.2.8

func (nwp NetWithPortRange) Overlap(other NetWithPortRange) bool

func (NetWithPortRange) String

func (nwp NetWithPortRange) String() string

type PortRange

type PortRange struct {
	From uint16
	To   uint16
}

func ParsePortRange

func ParsePortRange(raw string) (PortRange, error)

func (*PortRange) Contains added in v1.2.8

func (p *PortRange) Contains(port uint16) bool

func (*PortRange) IsNeighbor added in v1.2.9

func (p *PortRange) IsNeighbor(other PortRange) bool

func (*PortRange) Merge added in v1.2.9

func (p *PortRange) Merge(other PortRange) PortRange

func (*PortRange) Overlap added in v1.2.8

func (p *PortRange) Overlap(other PortRange) bool

func (*PortRange) String

func (p *PortRange) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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