2015-02-22 17:24:22 -08:00
|
|
|
package bridge
|
|
|
|
|
|
|
|
type SetupStep func(*Interface) error
|
|
|
|
|
|
|
|
type BridgeSetup struct {
|
|
|
|
bridge *Interface
|
|
|
|
steps []SetupStep
|
|
|
|
}
|
|
|
|
|
2015-02-22 21:11:12 -08:00
|
|
|
func NewBridgeSetup(i *Interface) *BridgeSetup {
|
|
|
|
return &BridgeSetup{bridge: i}
|
2015-02-22 17:24:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------//
|
|
|
|
|
2015-02-22 21:11:12 -08:00
|
|
|
func SetupIPTables(i *Interface) error {
|
2015-02-22 17:24:22 -08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-02-22 21:11:12 -08:00
|
|
|
func SetupIPForwarding(i *Interface) error {
|
2015-02-22 17:24:22 -08:00
|
|
|
return nil
|
|
|
|
}
|