Skip to content

Commit

Permalink
Adjustments to IP extracting middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMacocian committed Aug 13, 2024
1 parent 666f9c5 commit 907de5c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion GuildWarsPartySearch/Endpoints/LiveFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ await this.SendMessage(new PartySearchList

public override async Task SocketAccepted(CancellationToken cancellationToken)
{
var ipAddress = this.Context?.GetClientIP();
var ipAddress = this.Context?.Request.HttpContext.GetClientIP();
var scopedLogger = this.logger.CreateScopedLogger(nameof(this.SocketAccepted), ipAddress ?? string.Empty);
if (!await this.liveFeedService.AddClient(this.WebSocket!, ipAddress, this.Context?.GetPermissionLevel() ?? Models.PermissionLevel.None, cancellationToken))
{
Expand Down
2 changes: 0 additions & 2 deletions GuildWarsPartySearch/Middleware/IPExtractingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
var address = context.Connection.RemoteIpAddress?.ToString();
var scopedLogger = this.logger.CreateScopedLogger(nameof(this.InvokeAsync), address ?? string.Empty);
scopedLogger.LogDebug($"Received request");

if (context.Request.Headers.TryGetValue(CFConnectingIPHeaderKey, out var cfConnectingIpValues))
{
scopedLogger.LogDebug($"CF-Connecting-IP {string.Join(',', cfConnectingIpValues.Select(s => s))}");
Expand Down
1 change: 0 additions & 1 deletion GuildWarsPartySearch/Middleware/PermissioningMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
var address = context.Connection.RemoteIpAddress?.ToString();
var scopedLogger = this.logger.CreateScopedLogger(nameof(this.InvokeAsync), address ?? string.Empty);
scopedLogger.LogDebug($"Received request");
if (context.Request.Headers.TryGetValue(XApiKeyHeaderKey, out var xApiKeyvalues))
{
scopedLogger.LogDebug($"X-Api-Key {string.Join(',', xApiKeyvalues.Select(s => s))}");
Expand Down

0 comments on commit 907de5c

Please sign in to comment.