Documentation
¶
Overview ¶
Package znet contains utilities for network communication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateIPString ¶
PrivateIPString reports if this is a private non-public IP address.
This will return true for anything that is not an IP address, such as "example.com" or "localhost".
func RemovePort ¶
RemovePort removes the "port" part of an hostname.
This only works for "host:port", and not URLs. See net.SplitHostPort.
func SafeDialer ¶
SafeDialer is only alllowed to connect to the listed networks and ports on non-private addresses.
Any attempt to connect to e.g. "127.0.0.1" will return an error. This is intended for clients that should only connect to external resources from user input.
If the allowed lists are empty then "tcp4", "tcp6", "80", and "443" are used.
The Timeout and KeepAlive are set to 30 seconds.
Also see zhttputil.SafeTransport() and zhttputil.SafeClient().
Types ¶
This section is empty.