diff --git a/IPBanCore/Core/Interfaces/IIPBanFirewall.cs b/IPBanCore/Core/Interfaces/IIPBanFirewall.cs index a28ceb61..7536e985 100644 --- a/IPBanCore/Core/Interfaces/IIPBanFirewall.cs +++ b/IPBanCore/Core/Interfaces/IIPBanFirewall.cs @@ -175,29 +175,41 @@ public interface IIPBanFirewall : IUpdater, IDisposable /// public struct PacketEvent { + /// + /// FQDN of machine sending the event + /// + [System.Text.Json.Serialization.JsonPropertyName("f")] + public string FQDN { get; init; } + /// /// Source ip address of the packet /// - [System.Text.Json.Serialization.JsonPropertyName("s")] - public string SourceIpAddress { get; init; } + [System.Text.Json.Serialization.JsonPropertyName("l")] + public string LocalIpAddress { get; init; } /// /// Source port of the packet or 0 if unknown/not applicable /// [System.Text.Json.Serialization.JsonPropertyName("p")] - public int SourcePort { get; init; } + public int LocalPort { get; init; } + + /// + /// Remote country (if known) + /// + [System.Text.Json.Serialization.JsonPropertyName("c")] + public string RemoteCountry { get; set; } /// /// Destination ip address of the packet /// - [System.Text.Json.Serialization.JsonPropertyName("d")] - public string DestinationIpAddress { get; init; } + [System.Text.Json.Serialization.JsonPropertyName("r")] + public string RemoteIpAddress { get; init; } /// /// Destination port of the packet or 0 if unknown/not applicable /// - [System.Text.Json.Serialization.JsonPropertyName("r")] - public int DestinationPort { get; init; } + [System.Text.Json.Serialization.JsonPropertyName("o")] + public int RemotePort { get; init; } /// /// Rule name if known, otherwise null diff --git a/IPBanTests/IPBanFirewallTests.cs b/IPBanTests/IPBanFirewallTests.cs index 8a1ba330..d10f07d1 100644 --- a/IPBanTests/IPBanFirewallTests.cs +++ b/IPBanTests/IPBanFirewallTests.cs @@ -298,19 +298,19 @@ void PacketCallback(in PacketEvent e) firewall.SendPacketEvent(new PacketEvent { Allowed = false, - SourceIpAddress = "2.2.2.2", - SourcePort = 1234, - DestinationIpAddress = "3.3.3.3", - DestinationPort = 8000, + LocalIpAddress = "2.2.2.2", + LocalPort = 1234, + RemoteIpAddress = "3.3.3.3", + RemotePort = 8000, Outbound = false, Protocol = System.Net.Sockets.ProtocolType.Tcp, RuleName = "test" }).Sync(); Assert.IsNotNull(packetEvent); - Assert.AreEqual("2.2.2.2", packetEvent.Value.SourceIpAddress); - Assert.AreEqual(1234, packetEvent.Value.SourcePort); - Assert.AreEqual("3.3.3.3", packetEvent.Value.DestinationIpAddress); - Assert.AreEqual(8000, packetEvent.Value.DestinationPort); + Assert.AreEqual("2.2.2.2", packetEvent.Value.LocalIpAddress); + Assert.AreEqual(1234, packetEvent.Value.LocalPort); + Assert.AreEqual("3.3.3.3", packetEvent.Value.RemoteIpAddress); + Assert.AreEqual(8000, packetEvent.Value.RemotePort); Assert.AreEqual(System.Net.Sockets.ProtocolType.Tcp, packetEvent.Value.Protocol); Assert.AreEqual("test", packetEvent.Value.RuleName); Assert.AreEqual(false, packetEvent.Value.Allowed);