func GetFromName(name string) (NsHandle, error) {
	return GetFromPath(fmt.Sprintf("/var/run/netns/%s", name))
}
GetFromName gets a handle to a named network namespace such as one
created by `ip netns add`.
package netns
import (
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"strconv"
	"strings"
	"syscall"
	"golang.org/x/sys/unix"
)
const (
	CLONE_NEWUTS  = 0x04000000    
	CLONE_NEWIPC  = 0x08000000    
	CLONE_NEWUSER = 0x10000000    
	CLONE_NEWPID  = 0x20000000    
	CLONE_NEWNET  = 0x40000000    
	CLONE_IO      = 0x80000000    
	bindMountPath = "/run/netns"  
)
func Setns(ns NsHandle, nstype int) (err error) {
	return unix.Setns(int(ns), nstype)
}
func Set(ns NsHandle) (err error) {
	return Setns(ns, CLONE_NEWNET)
}
func New() (ns NsHandle, err error) {
	if err := unix.Unshare(CLONE_NEWNET); err != nil {
		return -1, err
	}
	return Get()
}
func NewNamed(name string) (NsHandle, error) {
	if _, err := os.Stat(bindMountPath); os.IsNotExist(err) {
		err = os.MkdirAll(bindMountPath, 0755)
		if err != nil {
			return None(), err
		}
	}
	newNs, err := New()
	if err != nil {
		return None(), err
	}
	namedPath := path.Join(bindMountPath, name)
	f, err := os.OpenFile(namedPath, os.O_CREATE|os.O_EXCL, 0444)
	if err != nil {
		return None(), err
	}
	f.Close()
	nsPath := fmt.Sprintf("/proc/%d/task/%d/ns/net", os.Getpid(), syscall.Gettid())
	err = syscall.Mount(nsPath, namedPath, "bind", syscall.MS_BIND, "")
	if err != nil {
		return None(), err
	}
	return newNs, nil
}
func DeleteNamed(name string) error {
	namedPath := path.Join(bindMountPath, name)
	err := syscall.Unmount(namedPath, syscall.MNT_DETACH)
	if err != nil {
		return err
	}
	return os.Remove(namedPath)
}
func Get() (NsHandle, error) {
	return GetFromThread(os.Getpid(), unix.Gettid())
}
func GetFromPath(path string) (NsHandle, error) {
	fd, err := unix.Open(path, unix.O_RDONLY|unix.O_CLOEXEC, 0)
	if err != nil {
		return -1, err
	}
	return NsHandle(fd), nil
}