netutil

package
v0.0.0-...-5d85a61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRelayIP

func CheckRelayIP(sender, addr net.IP) error

func IsLAN

func IsLAN(ip net.IP) bool

func IsSpecialNetwork

func IsSpecialNetwork(ip net.IP) bool

func IsTemporaryError

func IsTemporaryError(err error) bool

func SameNet

func SameNet(bits uint, ip, other net.IP) bool
Example
fmt.Println(SameNet(24, net.IP{127, 0, 0, 1}, net.IP{127, 0, 0, 3}))

fmt.Println(SameNet(24, net.IP{127, 3, 0, 1}, net.IP{127, 5, 0, 3}))
Output:

Types

type DistinctNetSet

type DistinctNetSet struct {
	Subnet uint
	Limit  uint
	// contains filtered or unexported fields
}

func (*DistinctNetSet) Add

func (s *DistinctNetSet) Add(ip net.IP) bool

func (DistinctNetSet) Contains

func (s DistinctNetSet) Contains(ip net.IP) bool

func (DistinctNetSet) Len

func (s DistinctNetSet) Len() int

func (*DistinctNetSet) Remove

func (s *DistinctNetSet) Remove(ip net.IP)

func (DistinctNetSet) String

func (s DistinctNetSet) String() string

type Netlist

type Netlist []net.IPNet

func ParseNetlist

func ParseNetlist(s string) (*Netlist, error)

func (*Netlist) Add

func (l *Netlist) Add(cidr string)

func (*Netlist) Contains

func (l *Netlist) Contains(ip net.IP) bool

func (Netlist) MarshalTOML

func (l Netlist) MarshalTOML() interface{}

func (*Netlist) UnmarshalTOML

func (l *Netlist) UnmarshalTOML(fn func(interface{}) error) error

Jump to

Keyboard shortcuts

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