mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 21:33:57 -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,27 @@
|
|||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"zerotier/pkg/zerotier"
|
||||
)
|
||||
|
||||
// RemoveRoot CLI command
|
||||
func RemoveRoot(basePath, authToken string, args []string) {
|
||||
if len(args) != 1 {
|
||||
Help()
|
||||
os.Exit(1)
|
||||
}
|
||||
result, _ := zerotier.APIDelete(basePath, zerotier.APISocketName, authToken, "/root/"+url.PathEscape(strings.TrimSpace(args[0])), nil)
|
||||
if result == http.StatusOK {
|
||||
fmt.Printf("%s removed\n", args[0])
|
||||
os.Exit(0)
|
||||
}
|
||||
fmt.Printf("ERROR: root %s not found or another error occurred: status code %d\n", args[0], result)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue