1
0
Fork 0
4Creative-Changes/CurrentPatches/0001-Add-External-Hostname-...

49 lines
1.9 KiB
Diff

From 6f363359d89cf5835d2fc32bedbdd89faf1311d1 Mon Sep 17 00:00:00 2001
From: Christopher <git@clatza.dev>
Date: Fri, 18 Mar 2022 13:55:34 +0100
Subject: [PATCH] Add External Hostname == DYNDNSIP to call current external ip
from aws services
---
OpenSim/Framework/RegionInfo.cs | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 507c51852b..f3bc127d54 100755
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -596,6 +596,30 @@ namespace OpenSim.Framework
m_log.InfoFormat(
"[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
m_externalHostName, name);
+ }else if(externalName == "DYNDNSIP")
+ {
+ m_externalHostName = Util.GetLocalHost().ToString();
+
+ try
+ {
+ using (WebClient getIpClient = new WebClient())
+ {
+ String externalip = getIpClient.DownloadString("http://checkip.amazonaws.com/");
+
+ if (externalip != null)
+ {
+ m_externalHostName = externalip.Trim();
+ m_log.InfoFormat("[REGIONINFO]: Resolving DYNDNSIP to {0} for region {1}", m_externalHostName, name);
+ }
+ else
+ {
+ m_log.ErrorFormat("[REGIONINFO]: Resolving DYNDNSIP failed for region {0}", name);
+ }
+ }
+ }catch(Exception error)
+ {
+ m_log.ErrorFormat("[REGIONINFO]: Resolving DYNDNSIP failed for region {0}: {1}", name, error.Message);
+ }
}
else if (!m_resolveAddress)
{
--
2.30.0.windows.2