f-10: code: add create and delete netns #10

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-01-08 23:37:35 +01:00
commit 454005d6ac
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
7 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,18 @@
//go:build linux
package netns
import (
"os"
"golang.org/x/sys/unix"
)
func delete(name string) error {
path := "/var/run/netns/" + name
if err := unix.Unmount(path, unix.MNT_DETACH); err != nil {
return err
}
return os.Remove(path)
}