Example #1
0
        private WireGuardConnection GetWireGuardConnection()
        {
            ProtonVPN.Common.Configuration.Config config = new();
            ILogger             logger = Substitute.For <ILogger>();
            IX25519KeyGenerator xIx25519KeyGenerator = Substitute.For <IX25519KeyGenerator>();
            WireGuardService    wireGuardService     =
                new(logger, new ProtonVPN.Common.Configuration.Config(), Substitute.For <IService>());
            TrafficManager trafficManager = new("ProtonVPN", logger);
            StatusManager  statusManager  = new(logger, string.Empty);

            return(new(logger, config, wireGuardService, trafficManager, statusManager, xIx25519KeyGenerator));
        }
Example #2
0
 public WireGuardConnection(
     ILogger logger,
     ProtonVPN.Common.Configuration.Config config,
     IService wireGuardService,
     TrafficManager trafficManager,
     StatusManager statusManager,
     IX25519KeyGenerator x25519KeyGenerator)
 {
     _logger                      = logger;
     _config                      = config;
     _wireGuardService            = wireGuardService;
     _trafficManager              = trafficManager;
     _statusManager               = statusManager;
     _x25519KeyGenerator          = x25519KeyGenerator;
     _trafficManager.TrafficSent += OnTrafficSent;
     _statusManager.StateChanged += OnStateChanged;
     _connectAction               = new SingleAction(ConnectAction);
     _connectAction.Completed    += OnConnectActionCompleted;
     _disconnectAction            = new SingleAction(DisconnectAction);
     _disconnectAction.Completed += OnDisconnectActionCompleted;
 }
Example #3
0
 public void Cleanup()
 {
     _generator = null;
 }
Example #4
0
 public void Initialize()
 {
     _generator = new X25519KeyGenerator();
 }