try to grab the external IP of localhost from the NAT router

This commit is contained in:
Matthias Mailänder
2013-08-07 19:07:23 +02:00
parent feb7f80a39
commit 9d40b430dc
3 changed files with 7 additions and 1 deletions

View File

@@ -68,6 +68,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
admin.IsVisible = () => orderManager.LobbyInfo.ClientWithIndex(clientIndex).IsAdmin;
latency.GetText = () => "Latency: {0}".F(LobbyUtils.LatencyDescription(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency));
var ipAddress = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress;
if ((ipAddress == null || ipAddress == "127.0.0.1") && UPnP.NatDevice != null)
ipAddress = UPnP.NatDevice.GetExternalIP().ToString();
ip.GetText = () => LobbyUtils.DescriptiveIpAddress(ipAddress);
location.GetText = () => LobbyUtils.LookupCountry(ipAddress);
}