mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
6311a96710
- Port and refactor docker/damon/driver ip tables setup function into libnetwork. - Taken care of golint guideline for CI to pass - Ran one more time goimports for CI to pass... Signed-off-by: Alessandro Boch <aboch@socketplane.io>
25 lines
453 B
Go
25 lines
453 B
Go
package bridge
|
|
|
|
type setupStep func(*bridgeInterface) error
|
|
|
|
type bridgeSetup struct {
|
|
bridge *bridgeInterface
|
|
steps []setupStep
|
|
}
|
|
|
|
func newBridgeSetup(i *bridgeInterface) *bridgeSetup {
|
|
return &bridgeSetup{bridge: i}
|
|
}
|
|
|
|
func (b *bridgeSetup) apply() error {
|
|
for _, fn := range b.steps {
|
|
if err := fn(b.bridge); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (b *bridgeSetup) queueStep(step setupStep) {
|
|
b.steps = append(b.steps, step)
|
|
}
|