Example #1
0
        public void EnableExcludeMode(string[] apps, string[] ips, IPAddress internetLocalIp)
        {
            Create();

            _ipFilter.Session.StartTransaction();
            try
            {
                var connectRedirectCallout = CreateConnectRedirectCallout();
                var redirectUDPCallout     = CreateUDPRedirectCallout();

                var providerContext = _ipFilter.CreateProviderContext(
                    new DisplayData
                {
                    Name        = "ProtonVPN Split Tunnel redirect context",
                    Description = "Instructs the callout driver where to redirect network connections",
                },
                    new ConnectRedirectData(internetLocalIp));

                CreateAppFilters(apps, redirectUDPCallout, Layer.BindRedirectV4, providerContext);

                CreateAppFilters(apps, connectRedirectCallout, Layer.AppConnectRedirectV4, providerContext);
                CreateIPFilters(ips, connectRedirectCallout, Layer.AppConnectRedirectV4, providerContext);

                _ipFilter.Session.CommitTransaction();
            }
            catch
            {
                _ipFilter.Session.AbortTransaction();
                throw;
            }
        }
Example #2
0
        public void EnableExcludeMode(IEnumerable <string> apps, IPAddress internetLocalIp)
        {
            Create();

            _ipFilter.Session.StartTransaction();
            try
            {
                var callout = _ipFilter.CreateCallout(
                    new DisplayData
                {
                    Name        = "ProtonVPN Split Tunnel callout",
                    Description = "Redirects network connections",
                },
                    WfpCalloutKey,
                    Layer.BindRedirectV4
                    );

                var providerContext = _ipFilter.CreateProviderContext(
                    new DisplayData
                {
                    Name        = "ProtonVPN Split Tunnel redirect context",
                    Description = "Instructs the callout driver where to redirect network connections",
                },
                    new BindingRedirectData(internetLocalIp));

                CreateAppFilters(apps, callout, providerContext);

                _ipFilter.Session.CommitTransaction();
            }
            catch
            {
                _ipFilter.Session.AbortTransaction();
                throw;
            }
        }