mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-17 02:45:03 +08:00
[fix]
This commit is contained in:
@ -32,4 +32,8 @@ public class InternalNetworkPermeateRealServer {
|
||||
* 访问端口
|
||||
*/
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 是否是ssl
|
||||
*/
|
||||
private Boolean isSsl;
|
||||
}
|
@ -5,6 +5,7 @@ import lombok.Setter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Deprecated
|
||||
@Setter
|
||||
@Getter
|
||||
public class NettyMsg {
|
||||
|
@ -14,7 +14,7 @@ import java.nio.charset.StandardCharsets;
|
||||
@Getter
|
||||
public class NettyProxyMsg {
|
||||
// body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
|
||||
public static final int bodyLength = 1 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
public static final int bodyLength = 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
|
||||
|
||||
/**
|
||||
@ -25,6 +25,13 @@ public class NettyProxyMsg {
|
||||
*/
|
||||
private byte type;
|
||||
|
||||
/**
|
||||
* 是否是ssl
|
||||
* byte 长度 1
|
||||
* 1 true
|
||||
* 0 false
|
||||
*/
|
||||
private byte isSsl = 0;
|
||||
/**
|
||||
* 客户端ID
|
||||
* byte[] 长度 4
|
||||
@ -110,4 +117,23 @@ public class NettyProxyMsg {
|
||||
}
|
||||
|
||||
|
||||
public Boolean isSsl() {
|
||||
return isSsl == 1;
|
||||
}
|
||||
|
||||
public void isSsl(Boolean isSsl) {
|
||||
if (isSsl) {
|
||||
this.isSsl = 1;
|
||||
} else {
|
||||
this.isSsl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public byte getIsSsl() {
|
||||
return isSsl;
|
||||
}
|
||||
|
||||
public void setIsSsl(byte isSsl) {
|
||||
this.isSsl = isSsl;
|
||||
}
|
||||
}
|
@ -109,6 +109,8 @@ public class NettyProxyMsgDecoder extends LengthFieldBasedFrameDecoder {
|
||||
int bodyLength = in.readInt();
|
||||
byte type = in.readByte();
|
||||
nettyProxyMsg.setType(type);
|
||||
byte isSsl = in.readByte();
|
||||
nettyProxyMsg.setIsSsl(isSsl);
|
||||
|
||||
int clientIdLength = in.readInt();
|
||||
byte[] clientIdBytes = new byte[clientIdLength];
|
||||
|
@ -23,6 +23,7 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
|
||||
// body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
|
||||
int bodyLength = NettyProxyMsg.bodyLength;
|
||||
byte typeBytes = msg.getType();
|
||||
byte isSsl = msg.getIsSsl();
|
||||
byte[] clientIdBytes = msg.getClientId();
|
||||
byte[] clientTargetIpBytes = msg.getClientTargetIp();
|
||||
byte[] clientTargetPortBytes = msg.getClientTargetPort();
|
||||
@ -30,7 +31,6 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
|
||||
byte[] visitorIdBytes = msg.getVisitorId();
|
||||
byte[] msgDataBytes = msg.getData();
|
||||
|
||||
|
||||
if (clientIdBytes != null) {
|
||||
bodyLength += clientIdBytes.length;
|
||||
}
|
||||
@ -54,6 +54,7 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
|
||||
out.writeInt(bodyLength);
|
||||
|
||||
out.writeByte(typeBytes);
|
||||
out.writeByte(isSsl);
|
||||
|
||||
// 防止数据读错位置 clientId
|
||||
if (clientIdBytes != null) {
|
||||
|
Reference in New Issue
Block a user