diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-08-10 13:12:14 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-08-10 13:12:14 +0200 |
| commit | 589ed2202dcfe3ae8669ef2e70eea6a482f195e4 (patch) | |
| tree | 3f9bf0c2aec302f27fe596943555fe57e0486237 /state.go | |
| parent | 94d3308eec4288d3ec1bb6f97c226e9f51785ca1 (diff) | |
State + Util: Create a valid URL by ensuring a scheme is present
Diffstat (limited to 'state.go')
| -rw-r--r-- | state.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |
