sdk

package
v0.0.0-...-a84a18f Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultContentTypeV1_1 = "application/vnd.docker.plugins.v1.1+json"

DefaultContentTypeV1_1 is the default content type accepted and sent by the plugins.

Variables

This section is empty.

Functions

func DecodeRequest

func DecodeRequest(w http.ResponseWriter, r *http.Request, req interface{}) (err error)

DecodeRequest decodes an http request into a given structure.

func EncodeResponse

func EncodeResponse(w http.ResponseWriter, res interface{}, err bool)

EncodeResponse encodes the given structure into an http response.

func PluginSpecDir

func PluginSpecDir(daemonRoot string) string

PluginSpecDir returns plugin spec dir in relation to daemon root directory.

func StreamResponse

func StreamResponse(w http.ResponseWriter, data io.ReadCloser)

StreamResponse streams a response object to the client

func WindowsDefaultDaemonRootDir

func WindowsDefaultDaemonRootDir() string

WindowsDefaultDaemonRootDir returns default data directory of docker daemon on Windows.

Types

type Handler

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

Handler is the base to create plugin handlers. It initializes connections and sockets to listen to.

func NewHandler

func NewHandler(manifest string) Handler

NewHandler creates a new Handler with an http mux.

func (Handler) HandleFunc

func (h Handler) HandleFunc(path string, fn func(w http.ResponseWriter, r *http.Request))

HandleFunc registers a function to handle a request path with.

func (Handler) Serve

func (h Handler) Serve(l net.Listener) error

Serve sets up the handler to serve requests on the passed in listener

func (Handler) ServeTCP

func (h Handler) ServeTCP(pluginName, addr, daemonDir string, tlsConfig *tls.Config) error

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 WindowsDefaultDaemonRootDir() function. On Unix, this parameter is ignored.

func (Handler) ServeUnix

func (h Handler) ServeUnix(addr string, gid int) error

ServeUnix makes the handler to listen for requests in a unix socket. It also creates the socket file in the right directory for docker to read.

func (Handler) ServeWindows

func (h Handler) ServeWindows(addr, pluginName, daemonDir string, pipeConfig *WindowsPipeConfig) error

ServeWindows makes the handler to listen for request in a Windows named pipe. It also creates 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 WindowsDefaultDaemonRootDir() function. On Unix, this parameter is ignored.

type WindowsPipeConfig

type WindowsPipeConfig struct {
	// SecurityDescriptor contains a Windows security descriptor in SDDL format.
	SecurityDescriptor string

	// InBufferSize in bytes.
	InBufferSize int32

	// OutBufferSize in bytes.
	OutBufferSize int32
}

WindowsPipeConfig is a helper structure for configuring named pipe parameters on Windows.

Jump to

Keyboard shortcuts

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