func CreateBridge(name string) error { if CheckBridge(name) == nil { return nil } if C.CreateBridge(C.CString(name)) < 0 { return errors.New("Failed to create bridge") } return nil }
func (t *TapManager) AddToBridge(bridge string) error { err := CheckBridge(bridge) if err != nil { if C.CreateBridge(C.CString(bridge)) != 0 { return errors.New("Failed to create bridge") } } if C.AddTapToBridge(C.CString(bridge), C.CString(t.name)) != 0 { return errors.New("Failed to add tap to bridge") } return nil }