/// <summary> /// Gets and loads server endpoints /// </summary> /// <param name="ct">The token to monitor for cancellation requests</param> /// <returns>Server endpoints</returns> public ServerEndpoints GetEndpoints(CancellationToken ct = default) { lock (EndpointsLock) { if (Endpoints != null) { return(Endpoints); } try { // Get and load API endpoints. var endpoints = new ServerEndpoints(); var uriBuilder = new UriBuilder(Base); uriBuilder.Path += ".well-known/vpn-user-portal"; Trace.TraceInformation("Loading endpoints {0}", uriBuilder.Uri); endpoints.LoadJSON(Xml.Response.Get( uri: uriBuilder.Uri, ct: ct).Value, ct); return(Endpoints = endpoints); } catch (OperationCanceledException) { throw; } catch (Exception ex) { throw new AggregateException(Resources.Strings.ErrorEndpointsLoad, ex); } } }