summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-11 10:19:56 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-11 12:42:11 +0200
commit565237c14a303a46d62d240b35c6f0082424256a (patch)
tree522f2aeb441a3eb22b6d5e05e66ef348241b2e66 /cmd
parent17e261dd224bc67f031b80930490768ea54353db (diff)
Client: Refactor out adding a Server from getting a config
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cli/main.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/cli/main.go b/cmd/cli/main.go
index 14ab6ea..dbded2d 100644
--- a/cmd/cli/main.go
+++ b/cmd/cli/main.go
@@ -8,6 +8,7 @@ import (
eduvpn "github.com/eduvpn/eduvpn-common"
"github.com/eduvpn/eduvpn-common/internal/server"
+ "github.com/eduvpn/eduvpn-common/types"
)
type ServerTypes int8
@@ -97,10 +98,22 @@ func getConfig(state *eduvpn.Client, url string, serverType ServerTypes) (string
}
// Prefer TCP is set to False
if serverType == ServerTypeInstituteAccess {
+ _, addErr := state.AddInstituteServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigInstituteAccess(url, false)
} else if serverType == ServerTypeCustom {
+ _, addErr := state.AddCustomServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigCustomServer(url, false)
}
+ _, addErr := state.AddSecureInternetHomeServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigSecureInternet(url, false)
}
@@ -128,8 +141,8 @@ func printConfig(url string, serverType ServerTypes) {
if configErr != nil {
// Show the usage of tracebacks and causes
- fmt.Println("Error getting config:", eduvpn.GetErrorTraceback(configErr))
- fmt.Println("Error getting config, cause:", eduvpn.GetErrorCause(configErr))
+ fmt.Println("Error getting config:", types.GetErrorTraceback(configErr))
+ fmt.Println("Error getting config, cause:", types.GetErrorCause(configErr))
return
}