MCPcopy Create free account
hub / github.com/docker/go-plugins-helpers / ServeTCP

Method ServeTCP

sdk/handler.go:45–54  ·  view source on GitHub ↗

ServeTCP makes the handler to listen for request in a given TCP address. It also writes the spec file in the right directory for docker to read. Due to constrains for running Docker in Docker on Windows, data-root directory of docker daemon must be provided. To get default directory, use WindowsDefa

(pluginName, addr, daemonDir string, tlsConfig *tls.Config)

Source from the content-addressed store, hash-verified

43// of docker daemon must be provided. To get default directory, use
44// WindowsDefaultDaemonRootDir() function. On Unix, this parameter is ignored.
45func (h Handler) ServeTCP(pluginName, addr, daemonDir string, tlsConfig *tls.Config) error {
46 l, spec, err := newTCPListener(addr, pluginName, daemonDir, tlsConfig)
47 if err != nil {
48 return err
49 }
50 if spec != "" {
51 defer os.Remove(spec)
52 }
53 return h.Serve(l)
54}
55
56// ServeUnix makes the handler to listen for requests in a unix socket.
57// It also creates the socket file in the right directory for docker to read.

Callers 2

TestMainFunction · 0.95
TestMainFunction · 0.95

Calls 3

ServeMethod · 0.95
newTCPListenerFunction · 0.85
RemoveMethod · 0.65

Tested by 2

TestMainFunction · 0.76
TestMainFunction · 0.76