2015-02-20 01:37:53 +00:00
|
|
|
package libnetwork
|
|
|
|
|
2016-01-30 01:08:11 +00:00
|
|
|
import (
|
2023-07-04 17:30:54 +00:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/docker/docker/libnetwork/driverapi"
|
2021-04-06 00:24:47 +00:00
|
|
|
"github.com/docker/docker/libnetwork/drivers/null"
|
|
|
|
"github.com/docker/docker/libnetwork/drivers/windows"
|
|
|
|
"github.com/docker/docker/libnetwork/drivers/windows/overlay"
|
2016-01-30 01:08:11 +00:00
|
|
|
)
|
2015-02-20 01:37:53 +00:00
|
|
|
|
2023-07-04 17:30:54 +00:00
|
|
|
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
|
|
|
|
for _, nr := range []struct {
|
|
|
|
ntype string
|
2023-07-04 17:43:16 +00:00
|
|
|
register func(driverapi.Registerer) error
|
2023-07-04 17:30:54 +00:00
|
|
|
}{
|
|
|
|
{ntype: null.NetworkType, register: null.Register},
|
|
|
|
{ntype: overlay.NetworkType, register: overlay.Register},
|
|
|
|
} {
|
2023-07-04 17:43:16 +00:00
|
|
|
if err := nr.register(r); err != nil {
|
2023-07-04 17:30:54 +00:00
|
|
|
return fmt.Errorf("failed to register %q driver: %w", nr.ntype, err)
|
|
|
|
}
|
2015-02-20 06:21:05 +00:00
|
|
|
}
|
2023-07-04 17:30:54 +00:00
|
|
|
|
|
|
|
return windows.RegisterBuiltinLocalDrivers(r, driverConfig)
|
2015-02-20 17:12:29 +00:00
|
|
|
}
|