func WithConfListFile(fileName string) CNIOpt {
	return func(c *libcni) error {
		confList, err := cnilibrary.ConfListFromFile(fileName)
		if err != nil {
			return err
		}
		i := len(c.networks)
		c.networks = append(c.networks, &Network{
			cni:    c.cniConfig,
			config: confList,
			ifName: getIfName(c.prefix, i),
		})
		return nil
	}
}
WithConfListFile can be used to load network config
from an .conflist file. Supported with absolute fileName
with path only.
package cni
import (
	"sort"
	"strings"
	cnilibrary "github.com/containernetworking/cni/libcni"
	"github.com/pkg/errors"
)
type CNIOpt func(c *libcni) error
func WithInterfacePrefix(prefix string) CNIOpt {
	return func(c *libcni) error {
		c.prefix = prefix
		return nil
	}
}
func WithPluginDir(dirs []string) CNIOpt {
	return func(c *libcni) error {
		c.pluginDirs = dirs
		c.cniConfig = &cnilibrary.CNIConfig{Path: dirs}
		return nil
	}
}
func WithPluginConfDir(dir string) CNIOpt {
	return func(c *libcni) error {
		c.pluginConfDir = dir
		return nil
	}
}
func WithMinNetworkCount(count int) CNIOpt {
	return func(c *libcni) error {
		c.networkCount = count
		return nil
	}
}
func WithLoNetwork(c *libcni) error {
	loConfig, _ := cnilibrary.ConfListFromBytes([]byte(`{
"cniVersion": "0.3.1",
"name": "cni-loopback",
"plugins": [{
  "type": "loopback"
}]
}`))
	c.networks = append(c.networks, &Network{
		cni:    c.cniConfig,
		config: loConfig,
		ifName: "lo",
	})
	return nil
}
func WithConf(bytes []byte) CNIOpt {
	return func(c *libcni) error {
		conf, err := cnilibrary.ConfFromBytes(bytes)
		if err != nil {
			return err
		}
		confList, err := cnilibrary.ConfListFromConf(conf)
		if err != nil {
			return err
		}
		c.networks = append(c.networks, &Network{
			cni:    c.cniConfig,
			config: confList,
			ifName: getIfName(c.prefix, 0),
		})
		return nil
	}
}
func WithConfFile(fileName string) CNIOpt {
	return func(c *libcni) error {
		conf, err := cnilibrary.ConfFromFile(fileName)
		if err != nil {
			return err
		}
		confList, err := cnilibrary.ConfListFromConf(conf)
		if err != nil {
			return err
		}
		c.networks = append(c.networks, &Network{
			cni:    c.cniConfig,
			config: confList,
			ifName: getIfName(c.prefix, 0),
		})
		return nil
	}
}