func (e *Environment) AddBridgeAddress() error {
	if e.BridgeLink == nil {
		bridge, err := netlink.LinkByName(e.BridgeName)
		if err != nil {
			return err
		}
		e.BridgeLink = bridge
	}
	addr, err := netlink.ParseAddr(e.BridgeAddress)
	if err != nil {
		return fmt.Errorf("Could not parse address %s: %v", e.BridgeAddress, err)
	}
	err = netlink.AddrAdd(e.BridgeLink, addr)
	if err != nil {
		return fmt.Errorf("Could not add address %s to bridge %s: %v", e.BridgeAddress, e.BridgeName, err)
	}
	return nil
}
AddBridgeAddress will add an address to an existing bridge
package network
import (
	"fmt"
	"net"
	"github.com/vishvananda/netlink"
)
func (e *Environment) CheckBridge() error {
	if e.BridgeLink == nil {
		bridge, err := netlink.LinkByName(e.BridgeName)
		if err != nil {
			return err
		}
		e.BridgeLink = bridge
	}
	state := e.BridgeLink.Attrs()
	if net.FlagUp&state.Flags == 0 {
		return fmt.Errorf("Bridge exists, but is configured to a [down] state")
	}
	switch state.OperState {
	case netlink.OperDown:
		return fmt.Errorf("Bridge exists, but Link is physically in a [down] state")
	}
	return nil
}
func (e *Environment) CreateBridge() error {
	mybridge := &netlink.Bridge{LinkAttrs: netlink.LinkAttrs{Name: e.BridgeName}}
	err := netlink.LinkAdd(mybridge)
	if err != nil {
		return fmt.Errorf("Could not add %s: %v", e.BridgeName, err)
	}
	return nil
}
func (e *Environment) DeleteBridge() error {
	if e.BridgeLink == nil {
		bridge, err := netlink.LinkByName(e.BridgeName)
		if err != nil {
			return err
		}
		e.BridgeLink = bridge
	}
	err := netlink.LinkDel(e.BridgeLink)
	if err != nil {
		return fmt.Errorf("Could not delete %s: %v", e.BridgeName, err)
	}
	e.BridgeLink = nil
	return nil
}