mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
904a313396
This commits brings in a functionality for remote drivers to register with LibNetwork. The Built-In remote driver is responsible for the actual "remote" plugin to be made available. Having such a mechanism makes libnetwork core not dependent on any external plugin mechanism and also the Libnetwork NB apis are free of Driver interface. Signed-off-by: Madhu Venugopal <madhu@docker.com>
27 lines
612 B
Go
27 lines
612 B
Go
package libnetwork
|
|
|
|
import (
|
|
"github.com/docker/libnetwork/driverapi"
|
|
"github.com/docker/libnetwork/drivers/bridge"
|
|
"github.com/docker/libnetwork/drivers/host"
|
|
"github.com/docker/libnetwork/drivers/null"
|
|
"github.com/docker/libnetwork/drivers/remote"
|
|
)
|
|
|
|
type driverTable map[string]driverapi.Driver
|
|
|
|
func enumerateDrivers(dc driverapi.DriverCallback) driverTable {
|
|
drivers := make(driverTable)
|
|
|
|
for _, fn := range [](func(driverapi.DriverCallback) (string, driverapi.Driver)){
|
|
bridge.New,
|
|
host.New,
|
|
null.New,
|
|
remote.New,
|
|
} {
|
|
name, driver := fn(dc)
|
|
drivers[name] = driver
|
|
}
|
|
|
|
return drivers
|
|
}
|