f-92: metadata: socket créée dans le netns du VPC, Restart=on-failure #92

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-26 23:47:48 +01:00
commit da4e0a194b
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
6 changed files with 131 additions and 45 deletions

View file

@ -1,5 +0,0 @@
package netns
func Enter(name string) error {
return enter(name)
}

View file

@ -1,26 +0,0 @@
//go:build linux
package netns
import (
"fmt"
"os"
"runtime"
"golang.org/x/sys/unix"
)
func enter(name string) error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
path := fmt.Sprintf("/var/run/netns/%s", name)
f, err := os.Open(path)
if err != nil {
return err
}
defer f.Close()
return unix.Setns(int(f.Fd()), unix.CLONE_NEWNET)
}

View file

@ -1,8 +0,0 @@
//go:build !linux
package netns
func enter(name string) error {
// Ignoré hors Linux
return nil
}