Allow local/LAN/WAN login-phase connections

Allow clients connecting from different IP domains (local/LAN/WAN) to get past login phase and clean unnecessary local server check.
This commit is contained in:
ronancpl
2021-04-09 20:54:53 -03:00
parent fa992da2eb
commit 7a3d5d2b94
13 changed files with 66 additions and 26 deletions

View File

@@ -286,8 +286,18 @@ public class Server {
}
public String[] getInetSocket(int world, int channel) {
public String[] getInetSocket(IoSession session, int world, int channel) {
String remoteIp = MapleSessionCoordinator.getSessionRemoteAddress(session);
String[] hostAddress = getIP(world, channel).split(":");
if (MapleSessionCoordinator.isLocalAddress(remoteIp)) {
hostAddress[0] = YamlConfig.config.server.LOCALHOST;
} else if (MapleSessionCoordinator.isLanAddress(remoteIp)) {
hostAddress[0] = YamlConfig.config.server.LANHOST;
}
try {
return getIP(world, channel).split(":");
return hostAddress;
} catch (Exception e) {
return null;
}