mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-11 03:13:51 +00:00
del[protocol]: deprecate PROTOCOL_ID
This commit is contained in:
1 parent
8cb904ba50
commit
4d703215e3
75 files changed
+147
-714
No files matched your search
@@ -104,7 +104,7 @@ public class Consumer implements IConsumer {
|
||||
|
||||
IPacket responsePacket = clientSignalAttachment.getResponseFuture().get(Router.DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||
|
||||
if (responsePacket.protocolId() == Error.errorProtocolId()) {
|
||||
if (responsePacket.getClass() == Error.class) {
|
||||
throw new ErrorResponseException((Error) responsePacket);
|
||||
}
|
||||
if (answerClass != null && answerClass != responsePacket.getClass()) {
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 22)
|
||||
public class AuthUidAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 22;
|
||||
|
||||
private String gatewayHostAndPort;
|
||||
|
||||
private long sid;
|
||||
@@ -36,11 +36,6 @@ public class AuthUidAsk implements IPacket {
|
||||
return ask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getGatewayHostAndPort() {
|
||||
return gatewayHostAndPort;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 网关登录成功过后,将uid授权给网关
|
||||
@@ -21,10 +22,9 @@ import com.zfoo.protocol.IPacket;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 20)
|
||||
public class AuthUidToGatewayCheck implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 20;
|
||||
|
||||
private long uid;
|
||||
|
||||
public static AuthUidToGatewayCheck valueOf(long uid) {
|
||||
@@ -33,15 +33,6 @@ public class AuthUidToGatewayCheck implements IPacket {
|
||||
return authUidToGateway;
|
||||
}
|
||||
|
||||
public static long getAuthProtocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 网关登录成功过后,将uid授权给网关的返回
|
||||
@@ -21,10 +22,9 @@ import com.zfoo.protocol.IPacket;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 21)
|
||||
public class AuthUidToGatewayConfirm implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 21;
|
||||
|
||||
private long uid;
|
||||
|
||||
public static AuthUidToGatewayConfirm valueOf(long uid) {
|
||||
@@ -33,11 +33,6 @@ public class AuthUidToGatewayConfirm implements IPacket {
|
||||
return authUidToGateway;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 23)
|
||||
public class GatewaySessionInactiveAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 23;
|
||||
|
||||
private String gatewayHostAndPort;
|
||||
|
||||
private long sid;
|
||||
@@ -36,11 +36,6 @@ public class GatewaySessionInactiveAsk implements IPacket {
|
||||
return ask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getGatewayHostAndPort() {
|
||||
return gatewayHostAndPort;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,10 +24,9 @@ import java.util.Map;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 24)
|
||||
public class GatewaySynchronizeSidAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 24;
|
||||
|
||||
private String gatewayHostAndPort;
|
||||
|
||||
private Map<Long, Long> sidMap;
|
||||
@@ -38,15 +38,6 @@ public class GatewaySynchronizeSidAsk implements IPacket {
|
||||
return ask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public static short gatewaySynchronizeProtocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public Map<Long, Long> getSidMap() {
|
||||
return sidMap;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.zfoo.net.packet.common.Ping;
|
||||
import com.zfoo.net.packet.common.Pong;
|
||||
import com.zfoo.net.router.attachment.GatewayAttachment;
|
||||
import com.zfoo.net.router.attachment.IAttachment;
|
||||
import com.zfoo.net.router.attachment.SignalAttachment;
|
||||
import com.zfoo.net.session.Session;
|
||||
import com.zfoo.net.util.SessionUtils;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
@@ -68,10 +67,10 @@ public class GatewayRouteHandler extends ServerRouteHandler {
|
||||
|
||||
var decodedPacketInfo = (DecodedPacketInfo) msg;
|
||||
var packet = decodedPacketInfo.getPacket();
|
||||
if (packet.protocolId() == Heartbeat.PROTOCOL_ID) {
|
||||
if (packet.getClass() == Heartbeat.class) {
|
||||
return;
|
||||
}
|
||||
if (packet.protocolId() == Ping.PROTOCOL_ID) {
|
||||
if (packet.getClass() == Ping.class) {
|
||||
NetContext.getRouter().send(session, Pong.valueOf(TimeUtils.now()), null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.zfoo.protocol.util.StringUtils;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageCodec;
|
||||
import io.netty.handler.codec.http.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
@@ -55,7 +53,7 @@ public class HttpCodecHandler extends MessageToMessageCodec<FullHttpRequest, Enc
|
||||
|
||||
var protocolVersion = attachment.getFullHttpRequest().protocolVersion();
|
||||
var httpResponseStatus = attachment.getHttpResponseStatus();
|
||||
if (packet.protocolId() == Message.PROTOCOL_ID) {
|
||||
if (packet.getClass() == Message.class) {
|
||||
var message = (Message) packet;
|
||||
if (message.fail()) {
|
||||
httpResponseStatus = HttpResponseStatus.BAD_REQUEST;
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.zfoo.protocol.generate.GenerateProtocolFile;
|
||||
import com.zfoo.protocol.registration.IProtocolRegistration;
|
||||
import com.zfoo.protocol.serializer.CodeLanguage;
|
||||
import com.zfoo.protocol.util.DomUtils;
|
||||
import com.zfoo.protocol.util.NumberUtils;
|
||||
import com.zfoo.protocol.util.StringUtils;
|
||||
import com.zfoo.protocol.xml.XmlProtocols;
|
||||
import com.zfoo.protocol.util.NumberUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -71,10 +71,6 @@ public class PacketService implements IPacketService {
|
||||
|
||||
|
||||
public static final String NET_COMMON_MODULE = "common";
|
||||
/**
|
||||
* 内网协议最大id
|
||||
*/
|
||||
public static final short MAN_NATIVE_PROTOCOL_ID = 100;
|
||||
|
||||
private final Predicate<IProtocolRegistration> netGenerateProtocolFilter = registration
|
||||
-> ProtocolManager.moduleByModuleId(registration.module()).getName().matches(NET_COMMON_MODULE)
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Ignore;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.ProtocolManager;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
import org.slf4j.helpers.FormattingTuple;
|
||||
import org.slf4j.helpers.MessageFormatter;
|
||||
|
||||
@@ -26,9 +26,8 @@ import org.slf4j.helpers.MessageFormatter;
|
||||
* @version 3.0
|
||||
*/
|
||||
@ProtobufClass
|
||||
@Protocol(id = 101)
|
||||
public class Error implements IPacket {
|
||||
@Ignore
|
||||
public static final short PROTOCOL_ID = 101;
|
||||
|
||||
@Protobuf(order = 1)
|
||||
private int module;
|
||||
@@ -37,15 +36,6 @@ public class Error implements IPacket {
|
||||
@Protobuf(order = 3)
|
||||
private String errorMessage;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public static short errorProtocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
FormattingTuple message = MessageFormatter.arrayFormat(
|
||||
|
||||
@@ -13,23 +13,16 @@
|
||||
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Ignore;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@ProtobufClass
|
||||
@Protocol(id = 102)
|
||||
public class Heartbeat implements IPacket {
|
||||
|
||||
@Ignore
|
||||
public static final short PROTOCOL_ID = 102;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Ignore;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.ProtocolManager;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 通用的返回,既可以用在远程调用,又可以嵌套在其它协议里
|
||||
@@ -25,9 +25,8 @@ import com.zfoo.protocol.ProtocolManager;
|
||||
* @version 3.0
|
||||
*/
|
||||
@ProtobufClass
|
||||
@Protocol(id = 100)
|
||||
public class Message implements IPacket {
|
||||
@Ignore
|
||||
public static final short PROTOCOL_ID = 100;
|
||||
|
||||
private byte module;
|
||||
|
||||
@@ -86,11 +85,6 @@ public class Message implements IPacket {
|
||||
return mess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public byte getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -23,10 +24,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 110)
|
||||
public class PairIntLong implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 110;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private int key;
|
||||
|
||||
@@ -40,11 +40,6 @@ public class PairIntLong implements IPacket {
|
||||
return pair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* Long + String
|
||||
@@ -23,10 +24,9 @@ import com.zfoo.protocol.IPacket;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 113)
|
||||
public class PairLS implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 113;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long key;
|
||||
|
||||
@@ -39,11 +39,6 @@ public class PairLS implements IPacket {
|
||||
return pair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -16,19 +16,15 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
|
||||
import java.util.Comparator;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 111)
|
||||
public class PairLong implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 111;
|
||||
|
||||
public static transient final Comparator<PairLong> NATURAL_VALUE_COMPARATOR = (a, b) -> Long.compare(a.getValue(), b.getValue());
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long key;
|
||||
|
||||
@@ -42,11 +38,6 @@ public class PairLong implements IPacket {
|
||||
return pair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 112)
|
||||
public class PairString implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 112;
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
@@ -34,11 +34,6 @@ public class PairString implements IPacket {
|
||||
return pair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,16 @@
|
||||
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Ignore;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@ProtobufClass
|
||||
@Protocol(id = 103)
|
||||
public class Ping implements IPacket {
|
||||
|
||||
@Ignore
|
||||
public static final short PROTOCOL_ID = 103;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,21 +13,19 @@
|
||||
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Ignore;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@ProtobufClass
|
||||
@Protocol(id = 104)
|
||||
public class Pong implements IPacket {
|
||||
|
||||
@Ignore
|
||||
public static final short PROTOCOL_ID = 104;
|
||||
|
||||
/**
|
||||
* 服务器当前的时间戳
|
||||
*/
|
||||
@@ -40,11 +38,6 @@ public class Pong implements IPacket {
|
||||
return pong;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,15 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 117)
|
||||
public class TripleLLS implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 117;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long left;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@@ -39,11 +39,6 @@ public class TripleLLS implements IPacket {
|
||||
return triple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* Long + String + String
|
||||
@@ -23,10 +24,9 @@ import com.zfoo.protocol.IPacket;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 116)
|
||||
public class TripleLSS implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 116;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long left;
|
||||
private String middle;
|
||||
@@ -40,11 +40,6 @@ public class TripleLSS implements IPacket {
|
||||
return triple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,15 @@ package com.zfoo.net.packet.common;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 114)
|
||||
public class TripleLong implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 114;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long left;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@@ -40,11 +40,6 @@ public class TripleLong implements IPacket {
|
||||
return triple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public long getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
package com.zfoo.net.packet.common;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 115)
|
||||
public class TripleString implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 115;
|
||||
|
||||
private String left;
|
||||
private String middle;
|
||||
private String right;
|
||||
@@ -35,11 +35,6 @@ public class TripleString implements IPacket {
|
||||
return triple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Router implements IRouter {
|
||||
*/
|
||||
@Override
|
||||
public void receive(Session session, IPacket packet, @Nullable IAttachment attachment) {
|
||||
if (packet.protocolId() == Heartbeat.PROTOCOL_ID) {
|
||||
if (packet.getClass() == Heartbeat.class) {
|
||||
logger.info("heartbeat");
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class Router implements IRouter {
|
||||
|
||||
// 网关授权,授权完成直接返回
|
||||
// 注意:这个 AuthUidToGatewayCheck 是在home的LoginController中处理完登录后,把消息发给网关进行授权
|
||||
if (AuthUidToGatewayCheck.getAuthProtocolId() == packet.protocolId()) {
|
||||
if (AuthUidToGatewayCheck.class == packet.getClass()) {
|
||||
var uid = ((AuthUidToGatewayCheck) packet).getUid();
|
||||
if (uid <= 0) {
|
||||
logger.error("错误的网关授权信息,uid必须大于0");
|
||||
@@ -187,7 +187,7 @@ public class Router implements IRouter {
|
||||
|
||||
IPacket responsePacket = clientSignalAttachment.getResponseFuture().get(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||
|
||||
if (responsePacket.protocolId() == Error.errorProtocolId()) {
|
||||
if (responsePacket.getClass() == Error.class) {
|
||||
throw new ErrorResponseException((Error) responsePacket);
|
||||
}
|
||||
if (answerClass != null && answerClass != responsePacket.getClass()) {
|
||||
@@ -229,7 +229,7 @@ public class Router implements IRouter {
|
||||
throw new NetTimeOutException("async ask [{}] timeout exception", packet.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
if (answer.protocolId() == Error.errorProtocolId()) {
|
||||
if (answer.getClass() == Error.class) {
|
||||
throw new ErrorResponseException((Error) answer);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.zfoo.net.session.Session;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 2)
|
||||
public class GatewayAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 2;
|
||||
|
||||
/**
|
||||
* session id
|
||||
*/
|
||||
@@ -80,11 +80,6 @@ public class GatewayAttachment implements IAttachment {
|
||||
return useTaskExecutorHashParam ? taskExecutorHashParam : (int) uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public void wrapTaskExecutorHash(Object argument) {
|
||||
this.useTaskExecutorHashParam = true;
|
||||
this.taskExecutorHashParam = argument.hashCode();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
import io.netty.handler.codec.http.FullHttpRequest;
|
||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
|
||||
@@ -19,10 +20,9 @@ import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 4)
|
||||
public class HttpAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 4;
|
||||
|
||||
private long uid;
|
||||
|
||||
private boolean useTaskExecutorHashParam;
|
||||
@@ -53,11 +53,6 @@ public class HttpAttachment implements IAttachment {
|
||||
return useTaskExecutorHashParam ? taskExecutorHashParam : (int) uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public void wrapTaskExecutorHash(Object argument) {
|
||||
this.useTaskExecutorHashParam = true;
|
||||
this.taskExecutorHashParam = argument.hashCode();
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* not used attachment
|
||||
*
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 5)
|
||||
public class NoAnswerAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 5;
|
||||
|
||||
private int taskExecutorHash;
|
||||
|
||||
public static NoAnswerAttachment valueOf(int taskExecutorHash) {
|
||||
@@ -35,11 +35,6 @@ public class NoAnswerAttachment implements IAttachment {
|
||||
return AttachmentType.NO_ANSWER_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public int getTaskExecutorHash() {
|
||||
return taskExecutorHash;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
import com.zfoo.scheduler.util.TimeUtils;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -23,10 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 0)
|
||||
public class SignalAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 0;
|
||||
|
||||
/**
|
||||
* EN:Negative signalId are allowed
|
||||
* CN:允许负数的signalId
|
||||
@@ -87,11 +87,6 @@ public class SignalAttachment implements IAttachment {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -12,16 +12,17 @@
|
||||
|
||||
package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 主要用来支持godot,unity,ts这种异步语法的使用,做为async/await语法的支撑
|
||||
*
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1)
|
||||
public class SignalOnlyAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 1;
|
||||
|
||||
private int signalId;
|
||||
|
||||
private long timestamp;
|
||||
@@ -31,11 +32,6 @@ public class SignalOnlyAttachment implements IAttachment {
|
||||
return AttachmentType.SIGNAL_ONLY_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
|
||||
package com.zfoo.net.router.attachment;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 3)
|
||||
public class UdpAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 3;
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
@@ -35,11 +36,6 @@ public class UdpAttachment implements IAttachment {
|
||||
return AttachmentType.UDP_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Arrays;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1119)
|
||||
public class CM_Array implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1119;
|
||||
|
||||
private int[] a;
|
||||
|
||||
private ObjectA[] b;
|
||||
@@ -51,11 +51,6 @@ public class CM_Array implements IPacket {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1112)
|
||||
public class CM_Float implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1112;
|
||||
|
||||
private float a;
|
||||
|
||||
private Float b;
|
||||
@@ -70,11 +70,6 @@ public class CM_Float implements IPacket {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1110)
|
||||
public class CM_Int implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1110;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
private byte a;
|
||||
@@ -95,11 +95,6 @@ public class CM_Int implements IPacket {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,10 +24,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1118, enhance = false)
|
||||
public class CM_List implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1118;
|
||||
|
||||
private List<Integer> list;
|
||||
|
||||
private List<List<Integer>> listWitList;
|
||||
@@ -56,15 +56,6 @@ public class CM_List implements IPacket {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static short getProtocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public List<List<Integer>> getListWitList() {
|
||||
return listWitList;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,10 +24,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1120, enhance = false)
|
||||
public class CM_Map implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1120;
|
||||
|
||||
private Map<Integer, Integer> map;
|
||||
|
||||
private Map<Integer, ObjectA> mapA;
|
||||
@@ -37,10 +37,6 @@ public class CM_Map implements IPacket {
|
||||
|
||||
private Map<List<Integer>, Map<List<Integer>, ObjectA>> mapWithListAndMap;
|
||||
|
||||
public static short getProtocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getMap() {
|
||||
return map;
|
||||
}
|
||||
@@ -49,11 +45,6 @@ public class CM_Map implements IPacket {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CM_Map{" + "map=" + map + ", mapA=" + mapA + ", mapB=" + mapB + ", mapC=" + mapC + '}';
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1114)
|
||||
public class CM_Object implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1114;
|
||||
|
||||
private int a;
|
||||
|
||||
private ObjectA b;
|
||||
@@ -50,11 +50,6 @@ public class CM_Object implements IPacket {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,10 +25,9 @@ import java.util.Set;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1121, enhance = false)
|
||||
public class CM_Set implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1121;
|
||||
|
||||
private Set<Integer> a;
|
||||
private Set<ObjectA> b;
|
||||
private Set<List<Integer>> c;
|
||||
@@ -36,11 +36,6 @@ public class CM_Set implements IPacket {
|
||||
private Set<Map<Integer, String>> setWithMap;
|
||||
private Set<List<Map<Integer, ObjectA>>> setListWithMap;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public Set<Integer> getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,20 +22,14 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1116)
|
||||
public class ObjectA implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1116;
|
||||
|
||||
private int a;
|
||||
|
||||
|
||||
private ObjectB objectB;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public int getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,17 +22,11 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1117)
|
||||
public class ObjectB implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1117;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public boolean isFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -14,21 +14,14 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1113)
|
||||
public class SM_Float implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1113;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1111)
|
||||
public class SM_Int implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1111;
|
||||
|
||||
private Boolean flag;
|
||||
|
||||
private Byte a;
|
||||
@@ -95,12 +95,6 @@ public class SM_Int implements IPacket {
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -14,19 +14,14 @@
|
||||
package com.zfoo.net.packet;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1115)
|
||||
public class SM_Object implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1115;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,10 +24,9 @@ import java.util.Set;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1165)
|
||||
public class CM_CSharpRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1165;
|
||||
|
||||
// 注释1
|
||||
public byte a;
|
||||
/**
|
||||
@@ -100,9 +100,4 @@ public class CM_CSharpRequest implements IPacket {
|
||||
*/
|
||||
public Set<Map<Integer, String>> sssss;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,20 +14,16 @@
|
||||
package com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1166)
|
||||
public class CSharpObjectA implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1166;
|
||||
|
||||
public int value;
|
||||
public CSharpObjectB objectB;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,15 @@
|
||||
package com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1167)
|
||||
public class CSharpObjectB implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1167;
|
||||
|
||||
public boolean flag;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
}
|
||||
@@ -14,22 +14,17 @@
|
||||
package com.zfoo.net.packet.gateway;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 5000)
|
||||
public class GatewayToProviderRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 5000;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -14,21 +14,17 @@
|
||||
package com.zfoo.net.packet.gateway;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 5001)
|
||||
public class GatewayToProviderResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 5001;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
package com.zfoo.net.packet.http;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1700)
|
||||
public class HttpHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1700;
|
||||
|
||||
private String message;
|
||||
|
||||
public static HttpHelloRequest valueOf(String message) {
|
||||
@@ -30,11 +30,6 @@ public class HttpHelloRequest implements IPacket {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,17 @@
|
||||
package com.zfoo.net.packet.http;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1701)
|
||||
public class HttpHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1701;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ package com.zfoo.net.packet.jprotobuf;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1500)
|
||||
public class JProtobufHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1500;
|
||||
|
||||
@Protobuf(order = 1)
|
||||
private String message;
|
||||
|
||||
@@ -32,11 +32,6 @@ public class JProtobufHelloRequest implements IPacket {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -14,24 +14,18 @@ package com.zfoo.net.packet.jprotobuf;
|
||||
|
||||
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1501)
|
||||
public class JProtobufHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1501;
|
||||
|
||||
@Protobuf(order = 1)
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,17 @@
|
||||
package com.zfoo.net.packet.json;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1600)
|
||||
public class JsonHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1600;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,21 +13,17 @@
|
||||
package com.zfoo.net.packet.json;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1601)
|
||||
public class JsonHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1601;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
|
||||
@@ -14,22 +14,16 @@
|
||||
package com.zfoo.net.packet.provider;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 4001)
|
||||
public class ProviderMessAnswer implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 4001;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -14,22 +14,17 @@
|
||||
package com.zfoo.net.packet.provider;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 4000)
|
||||
public class ProviderMessAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 4000;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,24 +13,18 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1153)
|
||||
public class AsyncMessAnswer implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1153;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,21 +13,17 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1152)
|
||||
public class AsyncMessAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1152;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
|
||||
@@ -13,22 +13,17 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1151)
|
||||
public class SyncMessAnswer implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1151;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
|
||||
@@ -13,22 +13,17 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1150)
|
||||
public class SyncMessAsk implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1150;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1300)
|
||||
public class TcpHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1300;
|
||||
|
||||
private String message;
|
||||
|
||||
public static TcpHelloRequest valueOf(String message) {
|
||||
@@ -30,11 +29,6 @@ public class TcpHelloRequest implements IPacket {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,17 @@
|
||||
package com.zfoo.net.packet.tcp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1301)
|
||||
public class TcpHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1301;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,16 @@
|
||||
package com.zfoo.net.packet.udp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1200)
|
||||
public class UdpHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1200;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,16 @@
|
||||
package com.zfoo.net.packet.udp;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1201)
|
||||
public class UdpHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1201;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet.websocket;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 2071)
|
||||
public class WebSocketObjectA implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 2071;
|
||||
|
||||
private int a;
|
||||
|
||||
private WebSocketObjectB objectB;
|
||||
@@ -46,11 +46,6 @@ public class WebSocketObjectA implements IPacket {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet.websocket;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,10 +22,9 @@ import java.util.Objects;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 2072)
|
||||
public class WebSocketObjectB implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 2072;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
@Override
|
||||
@@ -40,11 +40,6 @@ public class WebSocketObjectB implements IPacket {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.zfoo.net.packet.websocket;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,10 +24,9 @@ import java.util.Set;
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 2070)
|
||||
public class WebSocketPacketRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 2070;
|
||||
|
||||
private byte a;
|
||||
private Byte aa;
|
||||
private byte[] aaa;
|
||||
@@ -82,11 +82,6 @@ public class WebSocketPacketRequest implements IPacket {
|
||||
private Set<String> ssss;
|
||||
private Set<Map<Integer, String>> sssss;
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public byte getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,18 @@
|
||||
package com.zfoo.net.packet.websocket;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1400)
|
||||
public class WebsocketHelloRequest implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1400;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,16 @@
|
||||
package com.zfoo.net.packet.websocket;
|
||||
|
||||
import com.zfoo.protocol.IPacket;
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
* @version 3.0
|
||||
*/
|
||||
@Protocol(id = 1401)
|
||||
public class WebsocketHelloResponse implements IPacket {
|
||||
|
||||
public static final short PROTOCOL_ID = 1401;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@Override
|
||||
public short protocolId() {
|
||||
return PROTOCOL_ID;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user