func GetContainerHostIfacesIndex(name string) ([]string, error) {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	ifacesIdx := []int{}
	ifaces := []string{}
	origns, err := netns.Get()
	if err != nil {
		return nil, err
	}
	defer origns.Close()
	pid, err := getContainerPid(name)
	if err != nil {
		return nil, err
	}
	ns, err := netns.GetFromPid(pid)
	if err != nil {
		return nil, err
	}
	defer ns.Close()
	if err := netns.Set(ns); err != nil {
		return nil, err
	}
	links, err := netlink.LinkList()
	if err != nil {
		return nil, err
	}
	for _, l := range links {
		veth, ok := l.(*netlink.Veth)
		if !ok {
			continue
		}
		index, _ := netlink.VethPeerIndex(veth)
		ifacesIdx = append(ifacesIdx, index)
	}
	netns.Set(origns)
	for _, idx := range ifacesIdx {
		ifName, err := netlink.LinkByIndex(idx)
		if err != nil {
			return nil, err
		}
		ifaces = append(ifaces, ifName.Attrs().Name)
	}
	return ifaces, nil
}
GetContainerHostIfacesIndex returns the interfaces name on the host of the container
package docker
import (
	"fmt"
	"net"
	"runtime"
	"strconv"
	"github.com/pkg/errors"
	"github.com/vishvananda/netlink"
	"github.com/vishvananda/netns"
	"sigs.k8s.io/kind/pkg/exec"
)
func CreateNetwork(name, subnet string, masquerade bool) error {
	args := []string{"network", "create", "-d=bridge"}
	args = append(args, "-o", fmt.Sprintf("com.docker.network.bridge.enable_ip_masquerade=%t", masquerade))
	if subnet != "" {
		args = append(args, "--subnet", subnet)
		_, cidr, err := net.ParseCIDR(subnet)
		if err != nil {
			return err
		}
		m := net.CIDRMask(27, 32)
		cidr.Mask = m
		args = append(args, "--ip-range", cidr.String())
	}
	args = append(args, name)
	return exec.Command("docker", args...).Run()
}
func DeleteNetwork(name string) error {
	return exec.Command("docker", "network", "rm", name).Run()
}