Skip to content

Commit

Permalink
Merge pull request #139 from DireLines/addAdditionalRelays
Browse files Browse the repository at this point in the history
Add additional relays
  • Loading branch information
DireLines authored Apr 4, 2024
2 parents a356f32 + e346286 commit 200967c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
25 changes: 25 additions & 0 deletions cmd/croc/relays.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
29 changes: 9 additions & 20 deletions cmd/croc/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ 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"
"github.com/spf13/cobra"
)

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 {
Expand All @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 200967c

Please sign in to comment.