*: abstract out netns for multiple platforms

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-01-23 10:43:29 -05:00
parent ebdec2ea5b
commit fb87c2f68b
7 changed files with 218 additions and 128 deletions

View file

@ -0,0 +1,49 @@
// +build !linux
package sandbox
import (
"os"
)
func isNSorErr(nspath string) error {
return nil // TODO(vbatts) ... really not sure ...
}
func newNetNs() (*NetNs, error) {
return &NetNs{}, nil
}
func getNetNs(path string) (*NetNs, error) {
return &NetNs{}, nil
}
// NetNs handles data pertaining a network namespace
// for non-linux this is a noop
type NetNs struct {
symlink *os.File
}
func (nns *NetNs) Path() string {
return ""
}
func (nns *NetNs) symlinkCreate(name string) error {
return nil
}
func (nns *NetNs) symlinkRemove() error {
return nil
}
func (nns *NetNs) Close() error {
return nil
}
func (nns *NetNs) Remove() error {
return nil
}
func hostNetNsPath() (string, error) {
return "", nil // TODO(vbatts) maybe this should have a platform error?
}