summaryrefslogtreecommitdiff
path: root/state.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-08-10 13:12:14 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-08-10 13:12:14 +0200
commit589ed2202dcfe3ae8669ef2e70eea6a482f195e4 (patch)
tree3f9bf0c2aec302f27fe596943555fe57e0486237 /state.go
parent94d3308eec4288d3ec1bb6f97c226e9f51785ca1 (diff)
State + Util: Create a valid URL by ensuring a scheme is present
Diffstat (limited to 'state.go')
-rw-r--r--state.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/state.go b/state.go
index c046185..594df8d 100644
--- a/state.go
+++ b/state.go
@@ -234,6 +234,12 @@ func (state *VPNState) addInstituteServer(url string) (server.Server, error) {
func (state *VPNState) addCustomServer(url string) (server.Server, error) {
errorMessage := fmt.Sprintf("failed adding Custom server with url %s", url)
+ url, urlErr := util.EnsureValidURL(url)
+
+ if urlErr != nil {
+ return nil, &types.WrappedErrorMessage{Message: errorMessage, Err: urlErr}
+ }
+
customServer := &types.DiscoveryServer{BaseURL: url, DisplayName: map[string]string{"en": url}, Type: "custom_server"}
// A custom server is just an institute access server under the hood