Compare commits

..

5 Commits

Author SHA1 Message Date
Ponk
754e5e61f2 Merge pull request #185 from Arnuh/fix-client-local-address #patch
Fix masking of ip address when connecting locally
2023-08-20 18:26:59 +02:00
Ponk
afba85827a Merge pull request #186 from sashimi-yzh/fix-cats-eye-dropper #patch
fix the dropper of Cat's Eye
2023-08-20 18:21:20 +02:00
Zihao Yu
8cd5211b8b fix the dropper of Cat's Eye
* it was previously dropped from Scorpion, which is wrong
2023-08-20 22:55:43 +08:00
Arnah
2d7525f2b4 Fix cashshop exiting not using proper ip 2023-08-16 16:19:16 -06:00
Arnah
7adb25888f Stop masking ip address when connecting locally 2023-08-16 00:53:40 -06:00
5 changed files with 9 additions and 22 deletions

View File

@@ -19993,7 +19993,7 @@ USE `cosmic`;
(8220015, 1452015, 1, 1, 0, 22000),
(8220015, 1472031, 1, 1, 0, 22000),
(8220015, 1482010, 1, 1, 0, 22000),
(2110301, 4031568, 1, 1, 3911, 80000),
(2100108, 4031568, 1, 1, 3911, 80000),
(9300150, 4031774, 1, 1, 3361, 100000),
(9300150, 4031796, 1, 1, 3362, 100000),
(9300105, 4001118, 1, 1, 3814, 200000),

View File

@@ -39,7 +39,6 @@ import net.server.Server;
import net.server.channel.Channel;
import net.server.coordinator.login.LoginBypassCoordinator;
import net.server.coordinator.session.Hwid;
import net.server.coordinator.session.IpAddresses;
import net.server.coordinator.session.SessionCoordinator;
import net.server.coordinator.session.SessionCoordinator.AntiMulticlientResult;
import net.server.guild.Guild;
@@ -176,10 +175,7 @@ public class Client extends ChannelInboundHandlerAdapter {
private static String getRemoteAddress(io.netty.channel.Channel channel) {
String remoteAddress = "null";
try {
String hostAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
if (hostAddress != null) {
remoteAddress = IpAddresses.evaluateRemoteAddress(hostAddress); // thanks dyz for noticing Local/LAN/WAN connections not interacting properly
}
remoteAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
} catch (NullPointerException npe) {
log.warn("Unable to get remote address for client", npe);
}

View File

@@ -15,7 +15,6 @@ import net.encryption.InitializationVector;
import net.encryption.PacketCodec;
import net.packet.logging.InPacketLogger;
import net.packet.logging.OutPacketLogger;
import net.server.coordinator.session.IpAddresses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tools.PacketCreator;
@@ -35,10 +34,7 @@ public abstract class ServerChannelInitializer extends ChannelInitializer<Socket
String getRemoteAddress(Channel channel) {
String remoteAddress = "null";
try {
String hostAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
if (hostAddress != null) {
remoteAddress = IpAddresses.evaluateRemoteAddress(hostAddress); // thanks dyz for noticing Local/LAN/WAN connections not interacting properly
}
remoteAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
} catch (NullPointerException npe) {
log.warn("Unable to get remote address from netty Channel: {}", channel, npe);
}

View File

@@ -29,6 +29,7 @@ import constants.id.ItemId;
import constants.id.MapId;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import net.server.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import server.Trade;
@@ -181,7 +182,11 @@ public final class ChangeMapHandler extends AbstractPacketHandler {
c.disconnect(false, false);
return;
}
String[] socket = c.getChannelServer().getIP().split(":");
String[] socket = Server.getInstance().getInetSocket(c, c.getWorld(), c.getChannel());
if (socket == null) {
c.enableCSActions();
return;
}
chr.getCashShop().open(false);
chr.setSessionTransitionState();

View File

@@ -1,7 +1,5 @@
package net.server.coordinator.session;
import config.YamlConfig;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -16,14 +14,6 @@ public class IpAddresses {
.collect(Collectors.toList());
}
public static String evaluateRemoteAddress(String inetAddress) {
if (isLocalAddress(inetAddress) || isLanAddress(inetAddress)) {
return YamlConfig.config.server.HOST;
} else {
return inetAddress;
}
}
public static boolean isLocalAddress(String inetAddress) {
return inetAddress.startsWith("127.");
}