socket

package
v27.0.0-rc.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EnvKey = "DOCKER_CLI_PLUGIN_SOCKET"

EnvKey represents the well-known environment variable used to pass the plugin being executed the socket name it should listen on to coordinate with the host CLI.

Variables

This section is empty.

Functions

func ConnectAndWait

func ConnectAndWait(cb func())

ConnectAndWait connects to the socket passed via well-known env var, if present, and attempts to read from it until it receives an EOF, at which point cb is called.

Types

type PluginServer

type PluginServer struct {
	// contains filtered or unexported fields
}

func NewPluginServer

func NewPluginServer(h func(net.Conn)) (*PluginServer, error)

NewPluginServer creates a plugin server that listens on a new Unix domain socket. h is called for each new connection to the socket in a goroutine.

func (*PluginServer) Addr

func (pl *PluginServer) Addr() net.Addr

Addr returns the net.Addr of the underlying net.Listener.

func (*PluginServer) Close

func (pl *PluginServer) Close() error

Close ensures that the server is no longer accepting new connections and closes all existing connections. Existing connections will receive io.EOF.

The error value is that of the underlying net.Listner.Close call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL