f-10: bin: add a new binarie #10
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
a650a34fc3
commit
0d3d59a019
2 changed files with 41 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
goos: [linux]
|
goos: [linux]
|
||||||
goarch: [amd64]
|
goarch: [amd64]
|
||||||
binaries: [db, metadata, metacli, agent]
|
binaries: [db, metadata, metacli, agent, netns]
|
||||||
uses: ./.forgejo/workflows/build.yml
|
uses: ./.forgejo/workflows/build.yml
|
||||||
with:
|
with:
|
||||||
tag: ${{ needs.set-release-target.outputs.release_cible }}
|
tag: ${{ needs.set-release-target.outputs.release_cible }}
|
||||||
|
|
|
||||||
40
cmd/netns/main.go
Normal file
40
cmd/netns/main.go
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.g3e.fr/syonad/two/internal/netns"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
netns_name = flag.String("netns", "", "Network namespace à faire")
|
||||||
|
action = flag.String("action", "", "Action a faire")
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
switch *action {
|
||||||
|
case "create":
|
||||||
|
err := netns.Create(*netns_name)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
case "delete":
|
||||||
|
err := netns.Delete(*netns_name)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
case "check":
|
||||||
|
if netns.Exist(*netns_name) {
|
||||||
|
fmt.Printf("netns %s exist\n", *netns_name)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("netns %s do not exist\n", *netns_name)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fmt.Printf("Available commande:\n - create\n - delete\n - check\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue