mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
5c8950e84d
before: ``` $ time docker --help real 0m0.177s user 0m0.000s sys 0m0.040s ``` after: ``` $ time docker --help real 0m0.010s user 0m0.000s sys 0m0.000s ``` Signed-off-by: Brian Goff <cpuguy83@gmail.com>
18 lines
446 B
Go
18 lines
446 B
Go
package main
|
|
|
|
const daemonBinary = "dockerd"
|
|
|
|
// DaemonProxy acts as a cli.Handler to proxy calls to the daemon binary
|
|
type DaemonProxy struct{}
|
|
|
|
// NewDaemonProxy returns a new handler
|
|
func NewDaemonProxy() DaemonProxy {
|
|
return DaemonProxy{}
|
|
}
|
|
|
|
// Command returns a cli command handler if one exists
|
|
func (p DaemonProxy) Command(name string) func(...string) error {
|
|
return map[string]func(...string) error{
|
|
"daemon": p.CmdDaemon,
|
|
}[name]
|
|
}
|