etcd: Index | Files

package netutil

import ""

Package netutil implements network-related utility functions.


Package Files

doc.go isolate_linux.go netutil.go routes_linux.go

func DropPort Uses

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 Uses

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 Uses

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

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

func IsNetworkTimeoutError Uses

func IsNetworkTimeoutError(err error) bool

func RecoverPort Uses

func RecoverPort(port int) error

RecoverPort stops dropping tcp packets at given port.

func RemoveLatency Uses

func RemoveLatency() error

RemoveLatency resets latency configurations.

func SetLatency Uses

func SetLatency(ms, rv int) error

SetLatency adds latency in millisecond scale with random variations.

func URLStringsEqual Uses

func URLStringsEqual(ctx context.Context, lg *zap.Logger, a []string, b []string) (bool, error)

URLStringsEqual returns "true" if given URLs are valid and resolved to same IP addresses. Otherwise, return "false" and error, if any.

Package netutil imports 14 packages (graph) and is imported by 707 packages. Updated 2020-05-11. Refresh now. Tools for package owners.