mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-05-14 18:43:34 +00:00
- 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>
27 lines
531 B
Go
27 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)
|
|
}
|