Categorygithub.com/cybozu-go/netutil
modulepackage
1.4.9
Repository: https://github.com/cybozu-go/netutil.git
Documentation: pkg.go.dev

# README

GitHub release CI Go Reference Go Report Card

Add-ons for networking

This package overrides a package of the same name.

Features

  • Functions for IPv4/v6 address calculations.
  • Functions to identify network errors.
  • Functions for TLS constants.
  • Utilities for TCP keep-alive.
  • Interface to half-close connections.
  • golang.org/x/net/netutil functions.

Usage

Read the documentation.

License

netutil is licensed under the Apache License, Version 2.0.

# Functions

CipherSuiteString returns string ID for the given cipher suite defined in crypto/tls.
DetectMTU returns the right MTU value for communications to the Internet.
EqualIP is a custom mather of Gomega to assert IP equivalence.
HostsFunc returns a function to generate all IP addresses in a network.
IntToIP4 does the reverse of IP4ToInt.
IP4ToInt returns uint32 value for an IPv4 address.
IPAdd adds `val` to `ip`.
IPDiff calculates the numeric difference between two IP addresses.
IsConnectionRefused returns true if err indicates ECONNREFUSED errno.
IsNetworkUnreachable returns true if err indicates ENETUNREACH errno.
IsNoRouteToHost returns true if err indicates EHOSTUNREACH errno.
KeepAliveListener returns TCPKeepAliveListener if l is a *net.TCPListener.
LimitListener is the same as https://godoc.org/golang.org/x/net/netutil#LimitListener.
SetKeepAlive enables TCP keep-alive if c is a *net.TCPConn.
TLSVersionString returns string for the given SSL/TLS version.

# Variables

ErrIPv6 is an error that a function does not support IPv6.

# Structs

TCPKeepAliveListener wraps *net.TCPListener.

# Interfaces

HalfCloser is an interface for connections that can be half-closed.