netutil

package
Version: v0.0.0-...-5dd4785 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0, BSD-2-Clause Imports: 9 Imported by: 3

Documentation

Overview

Package netutil provides utility functions extending the stdnet package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUDP

func CheckUDP(local, remote *net.UDPAddr, checkAddress bool, checkPort bool) error

CheckUDP checks whether data send to remote is received at local, otherwise an error is returned. If checkAddress is set, it checks whether the IP address that was on the packet matches remote. If checkPort is set, it checks whether the port that was on the packet matches remote.

func GetPublicIP

func GetPublicIP(preferIPv6 bool) (net.IP, error)

GetPublicIP queries the ipify API for the public IP address.

func IsIPv4

func IsIPv4(ip net.IP) bool

IsIPv4 returns true if ip is an IPv4 address.

func IsTemporaryError

func IsTemporaryError(err error) bool

IsTemporaryError checks whether the given error should be considered temporary.

func IsValidPort

func IsValidPort(port int) bool

IsValidPort returns true if port is a valid port number.

Types

This section is empty.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL