Documentation ¶
Index ¶
- Constants
- func CloneIPNet(n *net.IPNet) (clone *net.IPNet)
- func CloneIPs(ips []net.IP) (clone []net.IP)
- func CloneURL(u *url.URL) (clone *url.URL)
- func ExtractIPAddress(r *http.Request) (string, error)
- func IPAndPortFromAddr(addr net.Addr) (ip net.IP, port int)
- func IPv4Zero() (ip net.IP)
- func IPv4allrouter() (ip net.IP)
- func IPv4allsys() (ip net.IP)
- func IPv4bcast() (ip net.IP)
- func IPv6Zero() (ip net.IP)
- func IsValidHostInnerRune(r rune) (ok bool)
- func IsValidHostOuterRune(r rune) (ok bool)
- func JoinHostPort(host string, port int) (hostport string)
- func ParseIP(s string) (ip net.IP, err error)
- func ParseIPv4(s string) (ip net.IP, err error)
- func ParseSubnet(s string) (n *net.IPNet, err error)
- func ParseSubnets(ss ...string) (ns []*net.IPNet, err error)
- func SingleIPSubnet(ip net.IP) (n *net.IPNet)
- func SplitHost(hostport string) (host string, err error)
- func SplitHostPort(hostport string) (host string, port int, err error)
- func ValidateIP(ip net.IP) (err error)
Constants ¶
const ( IPv4BitLen = net.IPv4len * 8 IPv6BitLen = net.IPv6len * 8 )
Bit lengths of IP addresses.
Variables ¶
This section is empty.
Functions ¶
func CloneURL ¶
CloneURL returns a deep clone of u. The User pointer of clone is the same, since a *url.Userinfo is effectively an immutable value.
func IPv4allrouter ¶
func IPv4allsys ¶
func IsValidHostInnerRune ¶
IsValidHostInnerRune returns true if r is a valid inner—that is, neither initial nor final—rune for a hostname label.
func IsValidHostOuterRune ¶
IsValidHostOuterRune returns true if r is a valid initial or final rune for a hostname label.
func JoinHostPort ¶
JoinHostPort is a convenient wrapper for net.JoinHostPort with port of type int. As opposed to net.JoinHostPort it also trims the host from square brackets if any. This may be useful when passing url.URL.Host field containing an IPv6 address.
func SplitHost ¶
SplitHost is a wrapper for net.SplitHostPort for cases when the hostport may or may not contain a port.
func SplitHostPort ¶
SplitHostPort is a convenient wrapper for net.SplitHostPort with port of type int.
func ValidateIP ¶
Types ¶
This section is empty.