Walter.Web.FireWall
IFireWall Interface
Members  Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall Namespace : IFireWall Interface
Interface IFireWall provides access to the FireWall management framework.
Object Model
IFireWall InterfaceIFireWallConfig InterfaceIFireWall InterfaceIDnsManager InterfaceIGeoFactory InterfaceIIncidentDatabase InterfaceIKnownLinks InterfaceILicenseManager InterfaceIRequestsDatabase InterfaceIRuntimeRulesEngine InterfaceIUriResolverDictionary InterfaceTalking Class
Syntax
public interface IFireWall : Walter.BOM.IControlledDiskIO, IFireWallDiskGuard  
Remarks
The interface can be used with dependency injection to gain access to the firewall.
Example
The firewall can easily be integrated into your code via dependency injection
using Microsoft.AspNetCore.Mvc;
             using System.Collections.Generic;
             using Walter.Web.FireWall;
            
             namespace ASP_WAF.Controllers
             {
                 public class FireWallController : Controller
                 {
                     IFireWall _fireWall;
                     public FireWallController(IFireWall fireWall)
                     {
                         _fireWall = fireWall;
                     }
                     public IActionResult Index()
                     {
                         return View();
                     }
            
                     public IActionResult LookWhoIsTalking()
                     {
                         var report = _fireWall.GetReport(Walter.Web.FireWall.Reporting.ReportTypes.Talking);
                         IEnumerable<Walter.Net.LookWhosTalking.TcpProcessHistoricRecord> talking = report.Details.Talking;
                         return View(talking);
                     }
                 }
             }
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
    var conf = new FireWallConfig(FireWallTrial.License, FireWallTrial.DomainKey, new System.Uri("https://localhost:5001", System.UriKind.Absolute))
    {
        AppDataFolder = datafolder,
            
    };
    conf.Geography.DataDetailLevels = GeoDataDetailLevels.County | GeoDataDetailLevels.City;
    conf.Geography.UseMethod = GeoMethod.UseFile;
    conf.Geography.ConnectionString = @"D:\MaxMind";
    conf.Geography[ContentType.GeoData.ToString()]  = Path.Combine(conf.Geography.ConnectionString, "GeoLite2-Country.mmdb");
    conf.Geography[ContentType.CityData.ToString()] = Path.Combine(conf.Geography.ConnectionString, "GeoLite2-City.mmdb");
            
    DIContainer.SetDefaultInstance<IFireWallConfig>(conf);
    var state = new DbState("dbo", "Data Source=LocalHost;Initial Catalog=AspWafFireWallState;Integrated Security=True;", TimeSpan.FromDays(365 * 3));
    DIContainer.SetDefaultInstance<DbState>(state);
    conf.Cashing.BufferFirewallData = TimeSpan.FromSeconds(3);
    var serviceProvider = new ServiceCollection()
                        .AddLogging()
                        .AddMemoryCache()
                        .AddSingleton<IFireWallConfig>(conf)
                        .AddSingleton(typeof(IFireWall), typeof(MyFireWall))
                        .AddSingleton(typeof(ILatLongRepository),typeof(MaxMindRepository))
                        .BuildServiceProvider();
    DIContainer.ServiceProvider = serviceProvider;
            
}
            
[TestMethod()]
public void FlushTest()
{
    var firewall = DIContainer.GetDefaultInstance<IFireWall>();
    // your test
            
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IFireWall Members
Walter.Web.FireWall Namespace