mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e797f80ad4
- Added api enhancement to pass driver specific config - Refactored simple bridge driver code for driver specific config - Added an undocumented option to add non-default bridges without manual pre-provisioning to help libnetwork testing - Reenabled libnetwork test to do api testing - Updated README.md Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
26 lines
531 B
Go
26 lines
531 B
Go
package bridge
|
|
|
|
type setupStep func(*Configuration, *bridgeInterface) error
|
|
|
|
type bridgeSetup struct {
|
|
config *Configuration
|
|
bridge *bridgeInterface
|
|
steps []setupStep
|
|
}
|
|
|
|
func newBridgeSetup(c *Configuration, i *bridgeInterface) *bridgeSetup {
|
|
return &bridgeSetup{config: c, bridge: i}
|
|
}
|
|
|
|
func (b *bridgeSetup) apply() error {
|
|
for _, fn := range b.steps {
|
|
if err := fn(b.config, b.bridge); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (b *bridgeSetup) queueStep(step setupStep) {
|
|
b.steps = append(b.steps, step)
|
|
}
|