diff options
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 3 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | 6 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 22 | ||||
-rw-r--r-- | bin/Robust.HG.ini.example | 4 | ||||
-rw-r--r-- | bin/Robust.ini.example | 3 |
5 files changed, 35 insertions, 3 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index c951653..31eefb1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | |||
@@ -54,9 +54,10 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | private IGatekeeperService m_GatekeeperService; | 55 | private IGatekeeperService m_GatekeeperService; |
56 | 56 | ||
57 | public GatekeeperAgentHandler(IGatekeeperService gatekeeper) | 57 | public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) |
58 | { | 58 | { |
59 | m_GatekeeperService = gatekeeper; | 59 | m_GatekeeperService = gatekeeper; |
60 | m_Proxy = proxy; | ||
60 | } | 61 | } |
61 | 62 | ||
62 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 63 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index dcb2725..49de8b1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -51,6 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
51 | get { return m_GatekeeperService; } | 51 | get { return m_GatekeeperService; } |
52 | } | 52 | } |
53 | 53 | ||
54 | bool m_Proxy = false; | ||
55 | |||
54 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : | 56 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : |
55 | base(config, server, String.Empty) | 57 | base(config, server, String.Empty) |
56 | { | 58 | { |
@@ -65,11 +67,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
65 | if (m_GatekeeperService == null) | 67 | if (m_GatekeeperService == null) |
66 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 68 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
67 | 69 | ||
70 | m_Proxy = gridConfig.GetBoolean("HasProxy", false); | ||
71 | |||
68 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); | 72 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); |
69 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); | 73 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
70 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | 74 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); |
71 | 75 | ||
72 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler); | 76 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler); |
73 | } | 77 | } |
74 | 78 | ||
75 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) | 79 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 2997430..1f7e502 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | protected bool m_Proxy = false; | ||
56 | |||
55 | public AgentHandler() { } | 57 | public AgentHandler() { } |
56 | 58 | ||
57 | public AgentHandler(ISimulationService sim) | 59 | public AgentHandler(ISimulationService sim) |
@@ -179,13 +181,31 @@ namespace OpenSim.Server.Handlers.Simulation | |||
179 | resp["reason"] = OSD.FromString(reason); | 181 | resp["reason"] = OSD.FromString(reason); |
180 | resp["success"] = OSD.FromBoolean(result); | 182 | resp["success"] = OSD.FromBoolean(result); |
181 | // Let's also send out the IP address of the caller back to the caller (HG 1.5) | 183 | // Let's also send out the IP address of the caller back to the caller (HG 1.5) |
182 | resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); | 184 | resp["your_ip"] = OSD.FromString(GetCallerIP(request)); |
183 | 185 | ||
184 | // TODO: add reason if not String.Empty? | 186 | // TODO: add reason if not String.Empty? |
185 | responsedata["int_response_code"] = HttpStatusCode.OK; | 187 | responsedata["int_response_code"] = HttpStatusCode.OK; |
186 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 188 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
187 | } | 189 | } |
188 | 190 | ||
191 | private string GetCallerIP(Hashtable request) | ||
192 | { | ||
193 | if (!m_Proxy) | ||
194 | return Util.GetCallerIP(request); | ||
195 | |||
196 | // We're behind a proxy | ||
197 | Hashtable headers = (Hashtable)request["headers"]; | ||
198 | if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) | ||
199 | { | ||
200 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | ||
201 | if (ep != null) | ||
202 | return ep.Address.ToString(); | ||
203 | } | ||
204 | |||
205 | // Oops | ||
206 | return Util.GetCallerIP(request); | ||
207 | } | ||
208 | |||
189 | // subclasses can override this | 209 | // subclasses can override this |
190 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 210 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
191 | { | 211 | { |
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index deceb86..0d87c4b 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -212,6 +212,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
212 | ; Does this grid allow incoming links to any region in it? | 212 | ; Does this grid allow incoming links to any region in it? |
213 | ; If false, HG TPs happen only to the Default regions specified in [GridService] section | 213 | ; If false, HG TPs happen only to the Default regions specified in [GridService] section |
214 | AllowTeleportsToAnyRegion = true | 214 | AllowTeleportsToAnyRegion = true |
215 | |||
216 | ; If you run this gatekeeper server behind a proxy, set this to true | ||
217 | ; HasProxy = true | ||
218 | |||
215 | 219 | ||
216 | [UserAgentService] | 220 | [UserAgentService] |
217 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" | 221 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 093ead8..e42268d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -141,6 +141,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
141 | ; For snowglobe's web map | 141 | ; For snowglobe's web map |
142 | ; MapTileURL = ""; | 142 | ; MapTileURL = ""; |
143 | 143 | ||
144 | ; If you run this login server behind a proxy, set this to true | ||
145 | ; HasProxy = true | ||
146 | |||
144 | 147 | ||
145 | [GridInfoService] | 148 | [GridInfoService] |
146 | ; These settings are used to return information on a get_grid_info call. | 149 | ; These settings are used to return information on a get_grid_info call. |