Example #1
0
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
}
Example #2
0
func AddTapToBridge(bridge, tap string) error {
	if C.AddTapToBridge(C.CString(bridge), C.CString(tap)) < 0 {
		return errors.New("Failed to add tap to bridge")
	}
	return nil
}