Documentation ¶
Index ¶
- Constants
- func DecodeRequest(w http.ResponseWriter, r *http.Request, req interface{}) (err error)
- func EncodeResponse(w http.ResponseWriter, res interface{}, err bool)
- func PluginSpecDir(daemonRoot string) string
- func StreamResponse(w http.ResponseWriter, data io.ReadCloser)
- func WindowsDefaultDaemonRootDir() string
- type Handler
- func (h Handler) HandleFunc(path string, fn func(w http.ResponseWriter, r *http.Request))
- func (h Handler) Serve(l net.Listener) error
- func (h Handler) ServeTCP(pluginName, addr, daemonDir string, tlsConfig *tls.Config) error
- func (h Handler) ServeUnix(addr string, gid int) error
- func (h Handler) ServeWindows(addr, pluginName, daemonDir string, pipeConfig *WindowsPipeConfig) error
- type WindowsPipeConfig
Constants ¶
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 ¶
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 ¶
NewHandler creates a new Handler with an http mux.
func (Handler) HandleFunc ¶
HandleFunc registers a function to handle a request path with.
func (Handler) ServeTCP ¶
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 ¶
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.