Documentation
¶
Index ¶
- Constants
- func DecodeRequest(w http.ResponseWriter, r *http.Request, req interface{}) (err error)
- func EncodeResponse(w http.ResponseWriter, res interface{})
- func PluginSpecDir(daemonRoot string) string
- func StreamResponse(w http.ResponseWriter, data io.ReadCloser)
- func WindowsDefaultDaemonRootDir() string
- type DriverImplementationName
- type ErrorResponse
- type Handler
- func (h Handler) HandleFunc(path string, fn handlers.HandlerFunc)
- func (h Handler) Serve(l net.Listener) error
- func (h Handler) ServeHTTP(res http.ResponseWriter, req *http.Request)
- 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
- func (h Handler) Use(m handlers.Middleware)
- type Manifest
- 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{})
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 DriverImplementationName ¶
type DriverImplementationName string
type ErrorResponse ¶
type ErrorResponse struct {
Err string
}
ErrorResponse is a formatted error message that Docker can understand
func NewErrorResponse ¶
func NewErrorResponse(err error) ErrorResponse
NewErrorResponse creates an ErrorResponse with the provided error
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(logger logrus.FieldLogger, manifest Manifest) Handler
NewHandler creates a new Handler with an http mux. It configures a single default route for the plugin activation and adds a bunch of middlewares.
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.
func (Handler) Use ¶
func (h Handler) Use(m handlers.Middleware)
Use adds a middleware at the beginning of the middleware stack. The lastly added middleware is called first. All the middlewares MUST wrap the `http.ResponseWriter` into a `negroni.ResponseWriter` so that one can call `ResponseWriter.Status()` and `ResponseWriter.Size()` in the various middlewares.
type Manifest ¶
type Manifest struct {
Implements []DriverImplementationName `json:"Implements"`
}
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.