Revert "Revert "Log ban hits in DB. ( (#6361)

This commit is contained in:
Pieter-Jan Briers
2022-02-02 22:57:11 +01:00
committed by GitHub
parent aaea5dd2d8
commit 5091c6aa9d
13 changed files with 2229 additions and 61 deletions

View File

@@ -40,6 +40,7 @@ namespace Content.Server.Database
public DbSet<ServerBan> Ban { get; set; } = default!;
public DbSet<ServerUnban> Unban { get; set; } = default!;
public DbSet<ConnectionLog> ConnectionLog { get; set; } = default!;
public DbSet<ServerBanHit> ServerBanHit { get; set; } = default!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -346,6 +347,8 @@ namespace Content.Server.Database
public Guid? BanningAdmin { get; set; }
public ServerUnban? Unban { get; set; }
public List<ServerBanHit> BanHits { get; set; } = null!;
}
[Table("server_unban")]
@@ -373,5 +376,27 @@ namespace Content.Server.Database
public IPAddress Address { get; set; } = null!;
public byte[]? HWId { get; set; }
public ConnectionDenyReason? Denied { get; set; }
public List<ServerBanHit> BanHits { get; set; } = null!;
}
public enum ConnectionDenyReason : byte
{
Ban = 0,
Whitelist = 1,
Full = 2,
}
public class ServerBanHit
{
public int Id { get; set; }
public int BanId { get; set; }
public int ConnectionId { get; set; }
public ServerBan Ban { get; set; } = null!;
public ConnectionLog Connection { get; set; } = null!;
}
}