Преглед изворни кода

Adding option those who have a special router which using its own local IP for port forwards. With this option you can turn your routers local IP to an external IP so people outside your internal network will be able to connect to your server.

Gigiikun пре 16 година
родитељ
комит
820332344b

+ 6 - 0
L2_GameServer/java/config/loginserver.properties

@@ -26,6 +26,12 @@ ExternalHostname = 127.0.0.1
 # Default: 127.0.0.1
 InternalHostname = 127.0.0.1
 
+# ---------------------------------------------------------------------------
+# If you are behind a router which using its own local IP for Port Forwarding then set this to the routers
+# local IP if you want people outside your internal network to be able to connect to your server.
+# ---------------------------------------------------------------------------
+# RouterHostname = 
+
 # Bind ip of the LoginServer, use * to bind on all available IPs
 # Default: *
 LoginserverHostname = *

+ 2 - 0
L2_GameServer/java/net/sf/l2j/Config.java

@@ -736,6 +736,7 @@ public final class Config
 	public static String GAME_SERVER_LOGIN_HOST;
 	public static String INTERNAL_HOSTNAME;
 	public static String EXTERNAL_HOSTNAME;
+	public static String ROUTER_HOSTNAME;
 	public static int PATH_NODE_RADIUS;
 	public static int NEW_NODE_ID;
 	public static int SELECTED_NODE_ID;
@@ -1983,6 +1984,7 @@ public final class Config
 
 					INTERNAL_HOSTNAME = serverSettings.getProperty("InternalHostname", "localhost");
 					EXTERNAL_HOSTNAME = serverSettings.getProperty("ExternalHostname", "localhost");
+					ROUTER_HOSTNAME = serverSettings.getProperty("RouterHostname", "");
 
 					DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
 					DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jdb");

+ 1 - 1
L2_GameServer/java/net/sf/l2j/loginserver/L2LoginClient.java

@@ -71,7 +71,7 @@ public final class L2LoginClient extends MMOClient<MMOConnection<L2LoginClient>>
 		_state = LoginClientState.CONNECTED;
 		String ip = getConnection().getInetAddress().getHostAddress();
 
-		if (Util.isInternalIP(ip))
+		if (Util.isInternalIP(ip) && !Config.ROUTER_HOSTNAME.equalsIgnoreCase(ip))
 		{
 			_usesInternalIP = true;
 		}