示例#1
0
        public SyncProfiles(
            Common.Configuration.Config appConfig,
            ILogger logger,
            IAppSettings appSettings,
            Profiles profiles,
            CachedProfiles cachedProfiles,
            ApiProfiles apiProfiles,
            SyncProfile syncProfile)
        {
            _appConfig      = appConfig;
            _logger         = logger;
            _appSettings    = appSettings;
            _profiles       = profiles;
            _cachedProfiles = cachedProfiles;
            _apiProfiles    = apiProfiles;
            _syncProfile    = syncProfile;

            _syncAction            = new CoalescingAction(SyncAction);
            _syncAction.Completed += OnSyncCompleted;

            _timer = new System.Timers.Timer
            {
                Interval  = _appConfig.ProfileSyncTimerPeriod.RandomizedWithDeviation(0.2).TotalMilliseconds,
                AutoReset = true
            };
            _timer.Elapsed += (s, e) => OnTimerElapsed();
        }
示例#2
0
        public LoginViewModel(
            Common.Configuration.Config appConfig,
            LoginWindowViewModel loginWindowViewModel,
            IActiveUrls urls,
            IAppSettings appSettings,
            LoginErrorViewModel loginErrorViewModel,
            UserAuth userAuth,
            IModals modals,
            GuestHoleConnector guestHoleConnector,
            GuestHoleState guestHoleState)
        {
            _appConfig            = appConfig;
            _userAuth             = userAuth;
            _appSettings          = appSettings;
            _urls                 = urls;
            _modals               = modals;
            _loginWindowViewModel = loginWindowViewModel;
            _guestHoleConnector   = guestHoleConnector;
            _guestHoleState       = guestHoleState;
            LoginErrorViewModel   = loginErrorViewModel;

            LoginCommand             = new RelayCommand(LoginAction);
            RegisterCommand          = new RelayCommand(RegisterAction);
            HelpCommand              = new RelayCommand(HelpAction);
            ToggleHelpBalloon        = new RelayCommand(ToggleBalloonAction);
            ResetPasswordCommand     = new RelayCommand(ResetPasswordAction);
            ForgotUsernameCommand    = new RelayCommand(ForgotUsernameAction);
            DisableKillSwitchCommand = new RelayCommand(DisableKillSwitchAction);
        }
示例#3
0
        public void Prepare_ShouldCreate_TlsExportCertFolder()
        {
            // Arrange
            const string path = nameof(Prepare_ShouldCreate_TlsExportCertFolder);

            if (Directory.Exists(path))
            {
                Directory.Delete(path);
            }

            var config = new Common.Configuration.Config
            {
                ServiceLogFolder = $"{path}-1",
                OpenVpn          =
                {
                    TlsExportCertFolder = path
                }
            };
            var subject = new ConfigDirectories(config);

            // Act
            subject.Prepare();
            // Assert
            Directory.Exists(path).Should().BeTrue();
        }
示例#4
0
 public VpnReconnector(IAppSettings appSettings,
                       ISimilarServerCandidatesGenerator similarServerCandidatesGenerator,
                       IModals modals,
                       IPopupWindows popups,
                       IVpnConnector vpnConnector,
                       INotificationSender notificationSender,
                       ILogger logger,
                       ServerCandidatesFactory serverCandidatesFactory,
                       Common.Configuration.Config config,
                       Lazy <ConnectionStatusViewModel> connectionStatusViewModel,
                       ServerManager serverManager,
                       Lazy <ServerConnector> serverConnector,
                       Lazy <ProfileConnector> profileConnector)
 {
     _appSettings = appSettings;
     _similarServerCandidatesGenerator = similarServerCandidatesGenerator;
     _modals                    = modals;
     _popups                    = popups;
     _vpnConnector              = vpnConnector;
     _notificationSender        = notificationSender;
     _logger                    = logger;
     _serverCandidatesFactory   = serverCandidatesFactory;
     _config                    = config;
     _connectionStatusViewModel = connectionStatusViewModel;
     _serverManager             = serverManager;
     _serverConnector           = serverConnector;
     _profileConnector          = profileConnector;
 }
        public MonitoredVpnService(Common.Configuration.Config appConfig, VpnSystemService service)
        {
            _service = service;

            _timer.Interval = appConfig.ServiceCheckInterval;
            _timer.Tick    += OnTimerTick;
        }
示例#6
0
 private SyncProfile(Common.Configuration.Config appConfig, ILogger logger, CachedProfiles cachedProfiles, IProfileStorageAsync apiProfiles)
 {
     _appConfig      = appConfig;
     _logger         = logger;
     _cachedProfiles = cachedProfiles;
     _apiProfiles    = apiProfiles;
 }
示例#7
0
 public VpnConfig(IApiClient apiClient, Common.Configuration.Config config)
 {
     _apiClient   = apiClient;
     TcpPorts     = config.DefaultOpenVpnTcpPorts;
     UdpPorts     = config.DefaultOpenVpnUdpPorts;
     BlackHoleIps = config.DefaultBlackHoleIps;
 }
 public VpnCredentialProvider(Common.Configuration.Config config, IAppSettings appSettings,
                              IUserStorage userStorage)
 {
     _config      = config;
     _userStorage = userStorage;
     _appSettings = appSettings;
 }
示例#9
0
 public FormViewModel(
     Common.Configuration.Config appConfig,
     IUserStorage userStorage,
     SystemState systemState)
 {
     _systemState = systemState;
     _appConfig   = appConfig;
     _userStorage = userStorage;
 }
示例#10
0
 public CurrentNetworkInterface(
     Common.Configuration.Config config,
     IServiceSettings serviceSettings,
     INetworkInterfaceLoader networkInterfaceLoader)
 {
     _config                 = config;
     _serviceSettings        = serviceSettings;
     _networkInterfaceLoader = networkInterfaceLoader;
 }
示例#11
0
 public NetworkSettings(
     ILogger logger,
     INetworkInterfaces networkInterfaces,
     Common.Configuration.Config config)
 {
     _config            = config;
     _logger            = logger;
     _networkInterfaces = networkInterfaces;
 }
 public SecureCoreProfileFormViewModel(
     Common.Configuration.Config appConfig,
     ColorProvider colorProvider,
     IUserStorage userStorage,
     ServerManager serverManager,
     ProfileManager profileManager,
     IModals modals,
     IDialogs dialogs) : base(appConfig, colorProvider, userStorage, profileManager, dialogs, modals, serverManager)
 {
 }
示例#13
0
 public SettingsStorage(ILogger logger, ITextSerializerFactory serializers, Common.Configuration.Config config)
 {
     _origin =
         new SafeStorage <SettingsContract>(
             new LoggingStorage <SettingsContract>(
                 logger,
                 new FileStorage <SettingsContract>(
                     serializers,
                     config.ServiceSettingsFilePath)));
 }
示例#14
0
        public VpnConfig(IApiClient apiClient, Common.Configuration.Config config)
        {
            _apiClient = apiClient;

            TcpPorts     = config.DefaultOpenVpnTcpPorts;
            UdpPorts     = config.DefaultOpenVpnUdpPorts;
            BlackHoleIps = config.DefaultBlackHoleIps;
            MaintenanceTrackerEnabled = config.MaintenanceTrackerEnabled;
            MaintenanceCheckInterval  = config.MaintenanceCheckInterval;
        }
示例#15
0
        public AuthCertificateUpdater(IScheduler scheduler,
                                      Common.Configuration.Config appConfig,
                                      IAuthCertificateManager authCertificateManager)
        {
            _appConfig = appConfig;
            _authCertificateManager = authCertificateManager;

            _timer       = scheduler.Timer();
            _timer.Tick += Timer_OnTick;
        }
示例#16
0
        public UpdateNotification(
            Common.Configuration.Config appConfig,
            IEventAggregator eventAggregator,
            UpdateFlashNotificationViewModel notificationViewModel)
        {
            _eventAggregator       = eventAggregator;
            _notificationViewModel = notificationViewModel;

            _remindInterval = appConfig.UpdateRemindInterval;
        }
示例#17
0
        public Attachments(ILogger logger, Common.Configuration.Config appConfig, IEnumerable <Attachment> logFileSource, IEnumerable <Attachment> selectFileSource)
        {
            _logFileSource = logFileSource;

            _filteredItems =
                new TooLargeAttachmentFilter(appConfig.ReportBugMaxFileSize,
                                             new FileLengthAttachmentFilter(logger,
                                                                            new TooManyAttachmentFilter(Items, appConfig.ReportBugMaxFiles,
                                                                                                        new ExistingAttachmentFilter(Items,
                                                                                                                                     selectFileSource))));
        }
示例#18
0
 public VpnCredentialProvider(
     Common.Configuration.Config config,
     IAppSettings appSettings,
     IUserStorage userStorage,
     IAuthCredentialManager authCredentialManager)
 {
     _config                = config;
     _userStorage           = userStorage;
     _appSettings           = appSettings;
     _authCredentialManager = authCredentialManager;
 }
示例#19
0
 public AboutModalViewModel(
     Common.Configuration.Config appConfig,
     UpdateService appUpdater,
     IAppSettings appSettings,
     UpdateViewModel updateViewModel)
 {
     _appConfig   = appConfig;
     _appUpdater  = appUpdater;
     _appSettings = appSettings;
     Update       = updateViewModel;
 }
示例#20
0
 protected BaseCountryServerProfileFormViewModel(
     Common.Configuration.Config appConfig,
     ColorProvider colorProvider,
     IUserStorage userStorage,
     ProfileManager profileManager,
     IDialogs dialogs,
     IModals modals,
     ServerManager serverManager) : base(appConfig, colorProvider, userStorage, profileManager, dialogs, modals, serverManager)
 {
     _modals = modals;
 }
示例#21
0
 public P2PDetector(
     ILogger logger,
     Common.Configuration.Config appConfig,
     IBlockedTraffic blockedTraffic,
     IForwardedTraffic forwardedTraffic,
     IScheduler scheduler,
     IModals modals,
     IDialogs dialogs) :
     this(logger, blockedTraffic, forwardedTraffic, scheduler.Timer(), modals, dialogs, appConfig.P2PCheckInterval.RandomizedWithDeviation(0.2))
 {
 }
示例#22
0
        public AccountModalViewModel(
            Common.Configuration.Config appConfig,
            IActiveUrls urls,
            IUserStorage userStorage)
        {
            _appConfig   = appConfig;
            _urls        = urls;
            _userStorage = userStorage;

            ManageAccountCommand     = new RelayCommand(ManageAccountAction);
            ProtonMailPricingCommand = new RelayCommand(ShowProtonMailPricing);
        }
示例#23
0
        public void TestInitialize()
        {
            _logger           = Substitute.For <ILogger>();
            _appConfig        = new Common.Configuration.Config();
            _logFileSource    = Substitute.For <IEnumerable <Attachment> >();
            _selectFileSource = Substitute.For <IEnumerable <Attachment> >();

            _appConfig.ReportBugMaxFiles    = 3;
            _appConfig.ReportBugMaxFileSize = 1000;
            _logFileSource.GetEnumerator().Returns(Enumerable.Empty <Attachment>().GetEnumerator());
            _selectFileSource.GetEnumerator().Returns(Enumerable.Empty <Attachment>().GetEnumerator());
        }
        public AccountModalViewModel(
            Common.Configuration.Config appConfig,
            IActiveUrls urls,
            IUserStorage userStorage,
            PricingBuilder pricingBuilder)
        {
            _appConfig      = appConfig;
            _urls           = urls;
            _userStorage    = userStorage;
            _pricingBuilder = pricingBuilder;

            ManageAccountCommand = new RelayCommand(ManageAccountAction);
        }
示例#25
0
 public GuestHoleConnector(
     IVpnServiceManager vpnServiceManager,
     IVpnConfig openVpnConfig,
     GuestHoleState guestHoleState,
     Common.Configuration.Config config,
     ICollectionStorage <GuestHoleServerContract> guestHoleServers)
 {
     _guestHoleServers  = guestHoleServers;
     _config            = config;
     _guestHoleState    = guestHoleState;
     _vpnServiceManager = vpnServiceManager;
     _openVpnConfig     = openVpnConfig;
 }
示例#26
0
 public ClientConfig(
     IAppSettings appSettings,
     IScheduler scheduler,
     IApiClient apiClient,
     Common.Configuration.Config config)
 {
     _appSettings    = appSettings;
     _apiClient      = apiClient;
     _timer          = scheduler.Timer();
     _timer.Interval = config.ClientConfigUpdateInterval.RandomizedWithDeviation(0.2);
     _timer.Tick    += Timer_OnTick;
     _updateAction   = new SingleAction(UpdateAction);
 }
示例#27
0
 public GuestHoleConnector(
     IVpnServiceManager vpnServiceManager,
     IAppSettings appSettings,
     GuestHoleState guestHoleState,
     Common.Configuration.Config config,
     ICollectionStorage <GuestHoleServerContract> guestHoleServers)
 {
     _guestHoleServers  = guestHoleServers;
     _config            = config;
     _guestHoleState    = guestHoleState;
     _vpnServiceManager = vpnServiceManager;
     _appSettings       = appSettings;
 }
示例#28
0
 public StreamingServicesUpdater(
     StreamingServicesStorage streamingServicesStorage,
     IApiClient apiClient,
     IScheduler scheduler,
     Common.Configuration.Config config)
 {
     _streamingServicesStorage = streamingServicesStorage;
     _apiClient      = apiClient;
     _timer          = scheduler.Timer();
     _timer.Interval = config.StreamingServicesUpdateInterval.RandomizedWithDeviation(0.2);
     _timer.Tick    += Timer_OnTick;
     _updateAction   = new SingleAction(UpdateStreamingServices);
 }
示例#29
0
 public Firewall(
     ILogger logger,
     Common.Configuration.Config config,
     INetworkInterfaces networkInterfaces,
     IpLayer ipLayer,
     Sublayer sublayer)
 {
     _logger            = logger;
     _config            = config;
     _networkInterfaces = networkInterfaces;
     _ipLayer           = ipLayer;
     _sublayer          = sublayer;
 }
示例#30
0
 public AboutModalViewModel(
     Common.Configuration.Config appConfig,
     UpdateService appUpdater,
     IAppSettings appSettings,
     UpdateViewModel updateViewModel,
     IModals modals)
 {
     _modals        = modals;
     _appConfig     = appConfig;
     _appUpdater    = appUpdater;
     _appSettings   = appSettings;
     Update         = updateViewModel;
     LicenseCommand = new RelayCommand(ShowLicense);
 }