Exemplo n.º 1
0
        private void PermitOpenVpnServerAddress(string address)
        {
            var(ip, guids) = _serverAddressFilters.FirstOrDefault();
            if (ip != null && ip == address)
            {
                _serverAddressFilters.RemoveAt(0);
                _serverAddressFilters.Add((ip, guids));
                return;
            }

            var filterGuids = new List <Guid>();

            _ipLayer.ApplyToIpv4(layer =>
            {
                filterGuids.Add(_sublayer.CreateRemoteIPv4Filter(
                                    new DisplayData("ProtonVPN permit OpenVPN server", "Permit server ip"),
                                    Action.HardPermit,
                                    layer,
                                    1,
                                    address));
            });

            _serverAddressFilters.Add((address, filterGuids));

            DeletePreviousFilters();
        }
Exemplo n.º 2
0
        public void Add(string address, Action action)
        {
            if (_list.ContainsKey(address))
            {
                return;
            }

            _list[address] = new List <Guid>();

            _ipLayer.ApplyToIpv4(layer =>
            {
                var guid = _sublayer.CreateRemoteIPv4Filter(
                    new DisplayData("ProtonVPN permit remote address", ""),
                    action,
                    layer,
                    14,
                    address);

                _list[address].Add(guid);
            });
        }