package sockets
import "github.com/docker/go-connections/sockets"
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 ¶
- Variables
- func ConfigureTransport(tr *http.Transport, proto, addr string) error
- func DialPipe(addr string, timeout time.Duration) (net.Conn, error)
- func DialerFromEnvironment(direct *net.Dialer) (*net.Dialer, error)
- func GetProxyEnv(key string) string
- func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error)
- type InmemSocket
Variables ¶
ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system.
Functions ¶
func ConfigureTransport ¶
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 ¶
DialPipe connects to a Windows named pipe.
func DialerFromEnvironment ¶
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 ¶
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 the specified tls configuration. If TLSConfig is set, will encapsulate the TCP listener inside a TLS one.
Types ¶
type InmemSocket ¶
type InmemSocket struct {
// contains filtered or unexported fields
}
InmemSocket implements net.Listener using in-memory only connections.
func NewInmemSocket ¶
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 ¶
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 ¶
func (s *InmemSocket) Addr() net.Addr
Addr returns the socket's addr string to satisfy net.Listener
func (*InmemSocket) Close ¶
func (s *InmemSocket) Close() error
Close closes the listener. It will be unavailable for use once closed.
func (*InmemSocket) Dial ¶
func (s *InmemSocket) Dial(network, addr string) (net.Conn, error)
Dial is used to establish a connection with the in-mem server
Source Files ¶
inmem_socket.go proxy.go sockets.go sockets_windows.go tcp_socket.go
- Version
- v0.5.0 (latest)
- Published
- Nov 10, 2023
- Platform
- windows/amd64
- Imports
- 10 packages
- Last checked
- 3 months ago –
Tools for package owners.