netutil

package
v0.0.0-...-f6c2049 Latest Latest
Warning

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

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

Documentation

Overview

Package netutil contains extensions to the net package.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRelayIP

func CheckRelayIP(sender, addr net.IP) error

CheckRelayIP reports whether an IP relayed from the given sender IP is a valid connection target.

There are four rules:

  • Special network addresses are never valid.
  • Loopback addresses are OK if relayed by a loopback host.
  • LAN addresses are OK if relayed by a LAN host.
  • All other addresses are always acceptable.

func IsLAN

func IsLAN(ip net.IP) bool

IsLAN reports whether an IP is a local network address.

func IsSpecialNetwork

func IsSpecialNetwork(ip net.IP) bool

IsSpecialNetwork reports whether an IP is located in a special-use network range This includes broadcast, multicast and documentation addresses.

func IsTemporaryError

func IsTemporaryError(err error) bool

IsTemporaryError checks whether the given error should be considered temporary.

func SameNet