netutil

package
v3.2.23 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package netutil implements network-related utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropPort

func DropPort(port int) error

DropPort drops all tcp packets that are received from the given port and sent to the given port.

func GetDefaultHost added in v3.1.0

func GetDefaultHost() (string, error)

GetDefaultHost obtains the first IP address of machine from the routing table and returns the IP address as string. An IPv4 address is preferred to an IPv6 address for backward compatibility.

func GetDefaultInterfaces added in v3.1.2

func GetDefaultInterfaces() (map[string]uint8, error)

GetDefaultInterfaces gets names of interfaces and returns a map[interface]families.

func IsNetworkTimeoutError

func IsNetworkTimeoutError(err error) bool

func RecoverPort

func RecoverPort(port int) error

RecoverPort stops dropping tcp packets at given port.

func RemoveLatency

func RemoveLatency() error

RemoveLatency resets latency configurations.

func SetLatency

func SetLatency(ms, rv int) error

SetLatency adds latency in millisecond scale with random variations.

func URLStringsEqual

func URLStringsEqual(ctx context.Context, a []string, b []string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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