public interface IFireWall : Walter.BOM.IControlledDiskIO, IFireWallDiskGuard
public interface IFireWall : Walter.BOM.IControlledDiskIO, IFireWallDiskGuard
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 }
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