summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-14 11:01:03 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-14 11:01:03 +0100
commitd9dd452748f524efc3e172f7181a8a538b9143c1 (patch)
treec5f85b6282e885a9a37ad479e44e160eecd74db4 /internal
parent25fdd94671d6b090992e8086334852dfd68f16d8 (diff)
Client + Server: Refresh the endpoints before checking for a valid profile
Diffstat (limited to 'internal')
-rw-r--r--internal/server/common.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/server/common.go b/internal/server/common.go
index 1b745cb..7d711f0 100644
--- a/internal/server/common.go
+++ b/internal/server/common.go
@@ -473,21 +473,27 @@ func HasValidProfile(server Server, clientSupportsWireguard bool) (bool, error)
return false, nil
}
-func GetConfig(server Server, clientSupportsWireguard bool, preferTCP bool) (string, string, error) {
- errorMessage := "failed getting an OpenVPN/WireGuard configuration"
+func RefreshEndpoints(server Server) error {
+ errorMessage := "failed to refresh server endpoints"
// Re-initialize the endpoints
// TODO: Make this a warning instead?
base, baseErr := server.GetBase()
if baseErr != nil {
- return "", "", types.NewWrappedError(errorMessage, baseErr)
+ return types.NewWrappedError(errorMessage, baseErr)
}
endpointsErr := base.InitializeEndpoints()
if endpointsErr != nil {
- return "", "", types.NewWrappedError(errorMessage, endpointsErr)
+ return types.NewWrappedError(errorMessage, endpointsErr)
}
+ return nil
+}
+
+func GetConfig(server Server, clientSupportsWireguard bool, preferTCP bool) (string, string, error) {
+ errorMessage := "failed getting an OpenVPN/WireGuard configuration"
+
profile, profileErr := getCurrentProfile(server)
if profileErr != nil {
return "", "", types.NewWrappedError(errorMessage, profileErr)