mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 13:24:09 -07:00
More plumbing
This commit is contained in:
parent
d1b780c7be
commit
b9911d0db7
18 changed files with 384 additions and 114 deletions
|
@ -13,6 +13,31 @@
|
|||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Leave CLI command
|
||||
func Leave(basePath, authToken string, args []string) {
|
||||
if len(args) != 1 {
|
||||
Help()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if len(args[0]) != 16 {
|
||||
fmt.Printf("ERROR: invalid network ID: %s\n", args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
nwid, err := strconv.ParseUint(args[0], 16, 64)
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: invalid network ID: %s\n", args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
nwids := fmt.Sprintf("%.16x", nwid)
|
||||
|
||||
apiDelete(basePath, authToken, "/network/"+nwids, nil)
|
||||
fmt.Printf("OK %s", nwids)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue