public void Add(string address, Action action)
        {
            if (_list.ContainsKey(address))
            {
                return;
            }

            var networkAddress = new Common.OS.Net.NetworkAddress(address);

            if (!networkAddress.Valid())
            {
                return;
            }

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

            _ipLayer.ApplyToIpv4(layer =>
            {
                var guid = _sublayer.CreateRemoteNetworkIPv4Filter(
                    new DisplayData("T4VPN permit remote address", ""),
                    action,
                    layer,
                    14,
                    new NetworkAddress(networkAddress.Ip, networkAddress.Mask));

                _list[address].Add(guid);
            });
        }
Esempio n. 2
0
        public void Add(string path, Action action)
        {
            if (_list.ContainsKey(path))
            {
                return;
            }

            if (!File.Exists(path))
            {
                return;
            }

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

            _ipLayer.ApplyToIpv4(layer =>
            {
                var guid = _sublayer.CreateAppFilter(
                    new DisplayData("Time4VPS VPN permit app", "Allow app to bypass VPN tunnel"),
                    action,
                    layer,
                    14,
                    path);

                _list[path].Add(guid);
            });
        }
 public void Add(string[] addresses, Action action)
 {
     foreach (var address in addresses)
     {
         Add(address, action);
     }
 }
Esempio n. 4
0
 public void Add(string[] paths, Action action)
 {
     foreach (var path in paths)
     {
         Add(path, action);
     }
 }