From fc48727f7f4ab30e8211cd36d9c9d59e3924a523 Mon Sep 17 00:00:00 2001 From: Nathaniel Saxe Date: Wed, 6 Mar 2024 23:24:03 -0600 Subject: [PATCH 1/3] remove alias listed at root cmd --- cmd/root.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 904bbcf..1a95131 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,10 +16,9 @@ var version string // Entrypoint for the CLI var rootCmd = &cobra.Command{ - Use: "runpodctl", - Aliases: []string{"runpod"}, - Short: "CLI for runpod.io", - Long: "The RunPod CLI tool to manage resources on runpod.io and develop serverless applications.", + Use: "runpodctl", + Short: "CLI for runpod.io", + Long: "The RunPod CLI tool to manage resources on runpod.io and develop serverless applications.", } func GetRootCmd() *cobra.Command { From af32e549ce55f1480ed825bae3d65f12675a5ceb Mon Sep 17 00:00:00 2001 From: Nathaniel Saxe Date: Tue, 2 Apr 2024 14:17:36 -0400 Subject: [PATCH 2/3] add additional relay servers to runpodctl config --- cmd/croc/relays.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmd/croc/relays.json b/cmd/croc/relays.json index b0f3d69..a584370 100644 --- a/cmd/croc/relays.json +++ b/cmd/croc/relays.json @@ -29,6 +29,31 @@ "address": "relay5.runpod.net", "password": "Op7X0378LX7ZB602&qIX#@qHU", "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" + }, + { + "address": "relay6.runpod.net", + "password": "Op7X0378LX7ZB602&qIX#@qHU", + "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" + }, + { + "address": "relay7.runpod.net", + "password": "Op7X0378LX7ZB602&qIX#@qHU", + "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" + }, + { + "address": "relay8.runpod.net", + "password": "Op7X0378LX7ZB602&qIX#@qHU", + "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" + }, + { + "address": "relay9.runpod.net", + "password": "Op7X0378LX7ZB602&qIX#@qHU", + "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" + }, + { + "address": "relay10.runpod.net", + "password": "Op7X0378LX7ZB602&qIX#@qHU", + "ports": "9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020" } ] } From e346286f608747145c866057016f6b9277b15bfc Mon Sep 17 00:00:00 2001 From: Nathaniel Saxe Date: Tue, 2 Apr 2024 14:18:25 -0400 Subject: [PATCH 3/3] simplify: use helper function in send.go --- cmd/croc/send.go | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/cmd/croc/send.go b/cmd/croc/send.go index eeb386b..32a4424 100644 --- a/cmd/croc/send.go +++ b/cmd/croc/send.go @@ -2,12 +2,10 @@ package croc import ( "fmt" - "strings" - "encoding/json" "math/rand" - "net/http" - "time" "strconv" + "strings" + "time" "github.com/schollz/croc/v9/src/models" "github.com/schollz/croc/v9/src/utils" @@ -15,9 +13,9 @@ import ( ) type Relay struct { - Address string `json:"address"` - Password string `json:"password"` - Ports string `json:"ports"` + Address string `json:"address"` + Password string `json:"password"` + Ports string `json:"ports"` } type Response struct { @@ -38,25 +36,16 @@ var SendCmd = &cobra.Command{ rand.Seed(time.Now().UnixNano()) // Make a GET request to the URL - res, err := http.Get(relayUrl) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - // Decode the JSON response - var response Response - err = json.NewDecoder(res.Body).Decode(&response) + relays, err := GetRelays() if err != nil { fmt.Println(err) fmt.Println("Could not get list of relays. Please contact support for help!") return } - + // Choose a random relay from the array - randomIndex := rand.Intn(len(response.Relays)) - relay := response.Relays[randomIndex] + randomIndex := rand.Intn(len(relays)) + relay := relays[randomIndex] crocOptions := Options{ Curve: "p256",