Terrarium.PeerToPeer.NetworkEngine.ValidatePeer C# (CSharp) Method

ValidatePeer() static private method

Figure out if our local DNS thinks the passed in ipAddress is valid for us.
static private ValidatePeer ( string ipAddress ) : bool
ipAddress string
return bool
        internal static bool ValidatePeer(string ipAddress)
        {
            try
            {
                if (GameConfig.EnableNat)
                {
                    return true;
                }

                var hostEntry = Dns.GetHostEntry(Dns.GetHostName());
                foreach (var ip in hostEntry.AddressList)
                {
                    if (ip.ToString() == ipAddress)
                    {
                        return true;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogHandledException(ex);
            }

            return false;
        }