Esempio n. 1
0
        private void BlockOutsideDns(uint weight, uint tapInterfaceIndex)
        {
            var callout = _sublayer.CreateCallout(
                new DisplayData
            {
                Name        = "ProtonVPN block dns callout",
                Description = "Sends server failure packet response for non TAP DNS queries.",
            },
                _networkLayerCalloutGuid,
                Layer.OutboundIPPacketV4);

            _sublayer.BlockOutsideDns(new DisplayData("ProtonVPN block DNS", "Block outside dns"),
                                      Layer.OutboundIPPacketV4,
                                      weight,
                                      callout,
                                      tapInterfaceIndex);

            _ipLayer.ApplyToIpv4(layer =>
            {
                _sublayer.CreateRemoteUdpPortFilter(new DisplayData(
                                                        "ProtonVPN DNS filter", "Permit UDP 53 port so we can block it at network layer"),
                                                    Action.HardPermit,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv4(layer =>
            {
                _sublayer.CreateRemoteTcpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS", "Block TCP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv6(layer =>
            {
                _sublayer.CreateRemoteTcpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS", "Block TCP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv6(layer =>
            {
                _sublayer.CreateRemoteUdpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS",
                                                        "Block UDP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });
        }
Esempio n. 2
0
 private void BlockAllIpv6Network(uint weight)
 {
     _ipLayer.ApplyToIpv6(layer =>
     {
         _sublayer.CreateLayerFilter(
             new DisplayData("ProtonVPN block IPv6", "Block all IPv6 traffic"),
             Action.SoftBlock,
             layer,
             weight);
     });
 }
Esempio n. 3
0
        private void BlockDns(uint weight)
        {
            _ipLayer.ApplyToIpv4(layer =>
            {
                _sublayer.CreateRemoteTcpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS", "Block TCP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv4(layer =>
            {
                _sublayer.CreateRemoteUdpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS",
                                                        "Block UDP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv6(layer =>
            {
                _sublayer.CreateRemoteTcpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS", "Block TCP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });

            _ipLayer.ApplyToIpv6(layer =>
            {
                _sublayer.CreateRemoteUdpPortFilter(new DisplayData(
                                                        "ProtonVPN block DNS",
                                                        "Block UDP 53 port"),
                                                    Action.HardBlock,
                                                    layer,
                                                    weight,
                                                    53);
            });
        }
Esempio n. 4
0
        private void PermitFromNetworkInterface(string id, uint weight)
        {
            _ipLayer.ApplyToIpv4(layer =>
            {
                _sublayer.CreateNetInterfaceFilter(
                    new DisplayData("ProtonVPN permit VPN tunnel", "Permit TAP adapter traffic"),
                    Action.SoftPermit,
                    layer,
                    weight,
                    id);
            });

            _ipLayer.ApplyToIpv6(layer =>
            {
                _sublayer.CreateNetInterfaceFilter(
                    new DisplayData("ProtonVPN permit VPN tunnel", "Permit TAP adapter traffic"),
                    Action.SoftPermit,
                    layer,
                    weight,
                    id);
            });
        }