Skip to content

Commit a0ff4b1

Browse files
committed
Add documentation
1 parent f7b4352 commit a0ff4b1

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

sdk/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ func (h *Handler) Serve(l net.Listener) error {
4141
return server.Serve(l)
4242
}
4343

44-
// Gracefully shuts down the http.Server serving requests
44+
// Shutdown gracefully shuts down the http.Server serving requests after Serve or
45+
// Serve{TCP,Unix,Windows} was called.
4546
func (h *Handler) Shutdown(c context.Context) error {
4647
return h.server.Shutdown(c)
4748
}

sdk/tcp_listener.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import (
88
"github.com/docker/go-connections/sockets"
99
)
1010

11+
// NewTCPListener constructs a net.Listener to use for serving requests at the given TCP address.
12+
// It also writes the spec file in the right directory for docker to read.
13+
//
14+
// Due to constrains for running Docker in Docker on Windows, data-root directory
15+
// of docker daemon must be provided. To get default directory, use
16+
// WindowsDefaultDaemonRootDir() function. On Unix, this parameter is ignored.
1117
func NewTCPListener(address, pluginName, daemonDir string, tlsConfig *tls.Config) (net.Listener, string, error) {
1218
listener, err := sockets.NewTCPSocket(address, tlsConfig)
1319
if err != nil {

sdk/unix_listener.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
const pluginSockDir = "/run/docker/plugins"
1414

15+
// NewUnixListener constructs a net.Listener to use for serving requests at the given unix socket.
16+
// It also creates the socket file in the right directory for docker to read.
1517
func NewUnixListener(pluginName string, gid int) (net.Listener, string, error) {
1618
path, err := fullSocketAddress(pluginName)
1719
if err != nil {

sdk/windows_listener_unsupported.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ var (
1111
errOnlySupportedOnWindows = errors.New("named pipe creation is only supported on Windows")
1212
)
1313

14+
// NewWindowsListener constructs a net.Listener to use for serving requests at the given Windows named pipe.
15+
// It also creates the spec file in the right directory for docker to read.
16+
//
17+
// Due to constrains for running Docker in Docker on Windows, the data-root directory
18+
// of docker daemon must be provided. To get default directory, use
19+
// WindowsDefaultDaemonRootDir() function. On Unix, this parameter is ignored.
1420
func NewWindowsListener(address, pluginName, daemonRoot string, pipeConfig *WindowsPipeConfig) (net.Listener, string, error) {
1521
return nil, "", errOnlySupportedOnWindows
1622
}

0 commit comments

Comments
 (0)