Evaluate player location on the server.

This commit is contained in:
Paul Chote
2020-01-11 12:14:10 +00:00
committed by abcdefg30
parent c430884c8b
commit 6b2c019caa
6 changed files with 8 additions and 26 deletions

View File

@@ -149,6 +149,8 @@ namespace OpenRA.Server
randomSeed = (int)DateTime.Now.ToBinary();
GeoIP.Initialize();
if (UPnP.Status == UPnPStatus.Enabled)
UPnP.ForwardPort(Settings.ListenPort, Settings.ListenPort).Wait();
@@ -341,10 +343,12 @@ namespace OpenRA.Server
return;
}
var ipAddress = ((IPEndPoint)newConn.Socket.RemoteEndPoint).Address;
var client = new Session.Client
{
Name = OpenRA.Settings.SanitizedPlayerName(handshake.Client.Name),
IpAddress = ((IPEndPoint)newConn.Socket.RemoteEndPoint).Address.ToString(),
IpAddress = ipAddress.ToString(),
Location = GeoIP.LookupCountry(ipAddress.ToString()),
Index = newConn.PlayerIndex,
PreferredColor = handshake.Client.PreferredColor,
Color = handshake.Client.Color,