mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-07 13:48:00 -05:00
Add ResolvedExternalIPAddress to API and Master Communication (#365)
* Feature: Add ResolvedExternalIPAddress to API and Master Communication This commit introduces the `ResolvedExternalIPAddress` property to enhance IP address reporting. 1. **Server API (`WebfrontCore/Controllers/API/Server.cs`):** The `ResolvedExternalIPAddress` property has been added to the JSON responses for the `/api/server` endpoints. This property is nullable and contains the IPv4 string value of the manager's external IP address if the server's resolved IP endpoint is an internal address. Otherwise, it is null. 2. **Master Server Communication (`MasterCommunication.cs` and `ApiServer.cs`):** - The `ApiServer` DTO (in `Application/API/Master/ApiServer.cs`) now includes the `ResolvedExternalIPAddress` property (serialized as `resolved_external_ip_address`). - The `UploadStatus` method in `Application/Misc/MasterCommunication.cs` now populates this property for each server being reported to the master server, using the same logic (external IP if server's own resolved IP is internal). This provides more comprehensive IP address information both through the web API and to the master server. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
parent
604aba628d
commit
3e186ca07a
@ -24,5 +24,7 @@ namespace IW4MAdmin.Application.API.Master
|
|||||||
public int ClientNum { get; set; }
|
public int ClientNum { get; set; }
|
||||||
[JsonPropertyName("maxclientnum")]
|
[JsonPropertyName("maxclientnum")]
|
||||||
public int MaxClientNum { get; set; }
|
public int MaxClientNum { get; set; }
|
||||||
|
[JsonPropertyName("resolved_external_ip_address")]
|
||||||
|
public string? ResolvedExternalIPAddress { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,8 @@ namespace IW4MAdmin.Application.Misc
|
|||||||
MaxClientNum = s.MaxClients,
|
MaxClientNum = s.MaxClients,
|
||||||
Id = s.EndPoint,
|
Id = s.EndPoint,
|
||||||
Port = (short)s.ListenPort,
|
Port = (short)s.ListenPort,
|
||||||
IPAddress = s.ListenAddress
|
IPAddress = s.ListenAddress,
|
||||||
|
ResolvedExternalIPAddress = s.ResolvedIpEndPoint.Address.IsInternal() ? _manager.ExternalIPAddress : null
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
WebfrontUrl = _appConfig.WebfrontUrl
|
WebfrontUrl = _appConfig.WebfrontUrl
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,7 @@ namespace SharedLibraryCore.Dtos
|
|||||||
public string IPAddress { get; set; }
|
public string IPAddress { get; set; }
|
||||||
public string ExternalIPAddress { get; set; }
|
public string ExternalIPAddress { get; set; }
|
||||||
public bool IsPasswordProtected { get; set; }
|
public bool IsPasswordProtected { get; set; }
|
||||||
|
public string? ResolvedExternalIPAddress { get; set; }
|
||||||
public string Endpoint => $"{IPAddress}:{Port}";
|
public string Endpoint => $"{IPAddress}:{Port}";
|
||||||
|
|
||||||
public double? LobbyZScore
|
public double? LobbyZScore
|
||||||
|
@ -39,6 +39,7 @@ namespace WebfrontCore.Controllers.API
|
|||||||
name = server.GametypeName
|
name = server.GametypeName
|
||||||
},
|
},
|
||||||
Parser = server.RconParser.Name,
|
Parser = server.RconParser.Name,
|
||||||
|
ResolvedExternalIPAddress = server.ResolvedIpEndPoint.Address.IsInternal() ? Manager.ExternalIPAddress : null,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ namespace WebfrontCore.Controllers.API
|
|||||||
name = foundServer.GametypeName
|
name = foundServer.GametypeName
|
||||||
},
|
},
|
||||||
Parser = foundServer.RconParser.Name,
|
Parser = foundServer.RconParser.Name,
|
||||||
|
ResolvedExternalIPAddress = foundServer.ResolvedIpEndPoint.Address.IsInternal() ? Manager.ExternalIPAddress : null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user