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

Functions

func ConfigureTransport

func ConfigureTransport(tr *http.Transport, proto, addr string)

ConfigureTransport configures the specified Transport according to the specified proto and addr. If the proto is unix (using a unix socket to communicate) the compression is disabled.

func DialPipe

func DialPipe(_ string, _ time.Duration) (net.Conn, error)

DialPipe connects to a Windows named pipe. This is not supported on other OSes.

func NewTCPSocket

func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error)

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.

func NewUnixSocket

func NewUnixSocket(path, group string) (net.Listener, error)

NewUnixSocket creates a unix socket with the specified path and group.

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 sockets.go sockets_unix.go tcp_socket.go unix_socket.go

Version
v0.1.3
Published
Feb 3, 2016
Platform
linux/amd64
Imports
12 packages
Last checked
1 hour ago

Tools for package owners.