Skip to content

Commit 55250ec

Browse files
committed
Adjust some properties
1 parent c6139ac commit 55250ec

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

IPBanCore/Core/Interfaces/IIPBanFirewall.cs

+19-7
Original file line numberDiff line numberDiff line change
@@ -175,29 +175,41 @@ public interface IIPBanFirewall : IUpdater, IDisposable
175175
/// </summary>
176176
public struct PacketEvent
177177
{
178+
/// <summary>
179+
/// FQDN of machine sending the event
180+
/// </summary>
181+
[System.Text.Json.Serialization.JsonPropertyName("f")]
182+
public string FQDN { get; init; }
183+
178184
/// <summary>
179185
/// Source ip address of the packet
180186
/// </summary>
181-
[System.Text.Json.Serialization.JsonPropertyName("s")]
182-
public string SourceIpAddress { get; init; }
187+
[System.Text.Json.Serialization.JsonPropertyName("l")]
188+
public string LocalIpAddress { get; init; }
183189

184190
/// <summary>
185191
/// Source port of the packet or 0 if unknown/not applicable
186192
/// </summary>
187193
[System.Text.Json.Serialization.JsonPropertyName("p")]
188-
public int SourcePort { get; init; }
194+
public int LocalPort { get; init; }
195+
196+
/// <summary>
197+
/// Remote country (if known)
198+
/// </summary>
199+
[System.Text.Json.Serialization.JsonPropertyName("c")]
200+
public string RemoteCountry { get; set; }
189201

190202
/// <summary>
191203
/// Destination ip address of the packet
192204
/// </summary>
193-
[System.Text.Json.Serialization.JsonPropertyName("d")]
194-
public string DestinationIpAddress { get; init; }
205+
[System.Text.Json.Serialization.JsonPropertyName("r")]
206+
public string RemoteIpAddress { get; init; }
195207

196208
/// <summary>
197209
/// Destination port of the packet or 0 if unknown/not applicable
198210
/// </summary>
199-
[System.Text.Json.Serialization.JsonPropertyName("r")]
200-
public int DestinationPort { get; init; }
211+
[System.Text.Json.Serialization.JsonPropertyName("o")]
212+
public int RemotePort { get; init; }
201213

202214
/// <summary>
203215
/// Rule name if known, otherwise null

IPBanTests/IPBanFirewallTests.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -298,19 +298,19 @@ void PacketCallback(in PacketEvent e)
298298
firewall.SendPacketEvent(new PacketEvent
299299
{
300300
Allowed = false,
301-
SourceIpAddress = "2.2.2.2",
302-
SourcePort = 1234,
303-
DestinationIpAddress = "3.3.3.3",
304-
DestinationPort = 8000,
301+
LocalIpAddress = "2.2.2.2",
302+
LocalPort = 1234,
303+
RemoteIpAddress = "3.3.3.3",
304+
RemotePort = 8000,
305305
Outbound = false,
306306
Protocol = System.Net.Sockets.ProtocolType.Tcp,
307307
RuleName = "test"
308308
}).Sync();
309309
Assert.IsNotNull(packetEvent);
310-
Assert.AreEqual("2.2.2.2", packetEvent.Value.SourceIpAddress);
311-
Assert.AreEqual(1234, packetEvent.Value.SourcePort);
312-
Assert.AreEqual("3.3.3.3", packetEvent.Value.DestinationIpAddress);
313-
Assert.AreEqual(8000, packetEvent.Value.DestinationPort);
310+
Assert.AreEqual("2.2.2.2", packetEvent.Value.LocalIpAddress);
311+
Assert.AreEqual(1234, packetEvent.Value.LocalPort);
312+
Assert.AreEqual("3.3.3.3", packetEvent.Value.RemoteIpAddress);
313+
Assert.AreEqual(8000, packetEvent.Value.RemotePort);
314314
Assert.AreEqual(System.Net.Sockets.ProtocolType.Tcp, packetEvent.Value.Protocol);
315315
Assert.AreEqual("test", packetEvent.Value.RuleName);
316316
Assert.AreEqual(false, packetEvent.Value.Allowed);

0 commit comments

Comments
 (0)