ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system.
var ErrProtocolNotAvailable = errors.New("protocol not available")
func ConfigureTransport(tr *http.Transport, proto, addr string) error
ConfigureTransport configures the specified http.Transport according to the specified proto and addr.
If the proto is unix (using a unix socket to communicate) or npipe the compression is disabled. For other protos, compression is enabled. If you want to manually enable/disable compression, make sure you do it _after_ any subsequent calls to ConfigureTransport is made against the same http.Transport.
func DialPipe(_ string, _ time.Duration) (net.Conn, error)
DialPipe connects to a Windows named pipe. This is not supported on other OSes.
func DialerFromEnvironment(direct *net.Dialer) (*net.Dialer, error)
DialerFromEnvironment was previously used to configure a net.Dialer to route connections through a SOCKS proxy. DEPRECATED: SOCKS proxies are now supported by configuring only http.Transport.Proxy, and no longer require changing http.Transport.Dial. Therefore, only sockets.ConfigureTransport() needs to be called, and any sockets.DialerFromEnvironment() calls can be dropped.
func GetProxyEnv(key string) string
GetProxyEnv allows access to the uppercase and the lowercase forms of proxy-related variables. See the Go specification for details on these variables. https://golang.org/pkg/net/http/
func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error)
NewTCPSocket creates a TCP socket listener with the specified address and the specified tls configuration. If TLSConfig is set, will encapsulate the TCP listener inside a TLS one.
func NewUnixSocket(path string, gid int) (net.Listener, error)
NewUnixSocket creates a unix socket with the specified path and group.
func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error)
NewUnixSocketWithOpts creates a unix socket with the specified options. By default, socket permissions are 0000 (i.e.: no access for anyone); pass WithChmod() and WithChown() to set the desired ownership and permissions.
This function temporarily changes the system's "umask" to 0777 to work around a race condition between creating the socket and setting its permissions. While this should only be for a short duration, it may affect other processes that create files/directories during that period.
InmemSocket implements net.Listener using in-memory only connections.
type InmemSocket struct {
// contains filtered or unexported fields
}
func NewInmemSocket(addr string, bufSize int) *InmemSocket
NewInmemSocket creates an in-memory only net.Listener The addr argument can be any string, but is used to satisfy the `Addr()` part of the net.Listener interface
func (s *InmemSocket) Accept() (net.Conn, error)
Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn.
func (s *InmemSocket) Addr() net.Addr
Addr returns the socket's addr string to satisfy net.Listener
func (s *InmemSocket) Close() error
Close closes the listener. It will be unavailable for use once closed.
func (s *InmemSocket) Dial(network, addr string) (net.Conn, error)
Dial is used to establish a connection with the in-mem server
SockOption sets up socket file's creating option
type SockOption func(string) error
func WithChmod(mask os.FileMode) SockOption
WithChmod modifies socket file's access mode.
func WithChown(uid, gid int) SockOption
WithChown modifies the socket file's uid and gid