try to grab the external IP of localhost from the NAT router
This commit is contained in:
@@ -16,7 +16,7 @@ using Mono.Nat.Upnp;
|
|||||||
|
|
||||||
namespace OpenRA.Network
|
namespace OpenRA.Network
|
||||||
{
|
{
|
||||||
class UPnP
|
public class UPnP
|
||||||
{
|
{
|
||||||
public static INatDevice NatDevice;
|
public static INatDevice NatDevice;
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,10 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath>
|
<HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Mono.Nat">
|
||||||
|
<HintPath>..\thirdparty\Mono.Nat.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Activities\LegacyCaptureActor.cs" />
|
<Compile Include="Activities\LegacyCaptureActor.cs" />
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
admin.IsVisible = () => orderManager.LobbyInfo.ClientWithIndex(clientIndex).IsAdmin;
|
admin.IsVisible = () => orderManager.LobbyInfo.ClientWithIndex(clientIndex).IsAdmin;
|
||||||
latency.GetText = () => "Latency: {0}".F(LobbyUtils.LatencyDescription(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency));
|
latency.GetText = () => "Latency: {0}".F(LobbyUtils.LatencyDescription(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency));
|
||||||
var ipAddress = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress;
|
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);
|
ip.GetText = () => LobbyUtils.DescriptiveIpAddress(ipAddress);
|
||||||
location.GetText = () => LobbyUtils.LookupCountry(ipAddress);
|
location.GetText = () => LobbyUtils.LookupCountry(ipAddress);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user