Documentation ¶
Overview ¶
Package sockets provides helper functions to create and configure Unix or TCP sockets.
Package sockets provides helper functions to create and configure Unix or TCP sockets.
Index ¶
- func ConfigureTransport(tr *http.Transport, proto, addr string) error
- func DialPipe(_ string, _ time.Duration) (net.Conn, error)
- func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error)
- func GetProxyEnv(key string) string
- func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error)
- func NewUnixSocket(path, group string) (net.Listener, error)
- type InmemSocket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureTransport ¶ added in v0.1.3
ConfigureTransport configures the specified 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.
func DialPipe ¶ added in v0.1.3
DialPipe connects to a Windows named pipe. This is not supported on other OSes.
func DialerFromEnvironment ¶ added in v0.2.0
DialerFromEnvironment takes in a "direct" *net.Dialer and returns a proxy.Dialer which will route the connections through the proxy using the given dialer.
func GetProxyEnv ¶ added in v0.2.0
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 ¶
NewTCPSocket creates a TCP socket listener with the specified address and and the specified tls configuration. If TLSConfig is set, will encapsulate the TCP listener inside a TLS one.
Types ¶
type InmemSocket ¶ added in v0.1.3
type InmemSocket struct {
// contains filtered or unexported fields
}
InmemSocket implements net.Listener using in-memory only connections.
func NewInmemSocket ¶ added in v0.1.3
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 (*InmemSocket) Accept ¶ added in v0.1.3
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 (*InmemSocket) Addr ¶ added in v0.1.3
func (s *InmemSocket) Addr() net.Addr
Addr returns the socket's addr string to satisfy net.Listener
func (*InmemSocket) Close ¶ added in v0.1.3
func (s *InmemSocket) Close() error
Close closes the listener. It will be unavailable for use once closed.