public ServerCandidates ServerCandidates(Profile profile)
        {
            if (profile == null)
            {
                return(_serverCandidatesFactory.ServerCandidates(new Server[0]));
            }

            var serverSpec = ProfileServerSpec(profile);
            var servers    = _serverManager.GetServers(serverSpec);

            return(_serverCandidatesFactory.ServerCandidates(servers));
        }
Exemple #2
0
        private async Task ConnectToSimilarServerOrQuickConnectAsync(bool isToTryLastServer, VpnProtocol vpnProtocol)
        {
            IList <Server> serverCandidates = _similarServerCandidatesGenerator
                                              .GenerateList(isToTryLastServer, _targetServer, _targetProfile);
            IEnumerable <Server> quickConnectServers = (await _vpnConnector.GetSortedAndValidQuickConnectServersAsync(
                                                            _config.MaxQuickConnectServersOnReconnection)).Except(serverCandidates);

            serverCandidates.AddRange(quickConnectServers);
            if (_config.MaxQuickConnectServersOnReconnection.HasValue)
            {
                serverCandidates = serverCandidates.Take(_config.MaxQuickConnectServersOnReconnection.Value).ToList();
            }
            ServerCandidates sortedCandidates =
                _serverCandidatesFactory.ServerCandidates((IReadOnlyCollection <Server>)serverCandidates);

            await ConnectToPreSortedCandidatesAsync(sortedCandidates, vpnProtocol);
        }
Exemple #3
0
 private ServerCandidates CreateServerCandidates(IList <Server> servers)
 {
     return(_serverCandidatesFactory.ServerCandidates((IReadOnlyCollection <Server>)servers));
 }