Commit 99318efd authored by Administrator's avatar Administrator

设备注册附加账户信息

parent e4a64e1d
......@@ -6,6 +6,7 @@ import com.virjar.echo.nat.protocol.EchoPacketDecoder;
import com.virjar.echo.nat.protocol.EchoPacketEncoder;
import com.virjar.echo.nat.protocol.PacketCommon;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
......@@ -30,7 +31,7 @@ public class EchoClient {
private String natServerHost;
private int natServerPort;
private String clientId;
private String adminAccount;
public EchoClient(String natServerHost, int natServerPort, String clientId) {
this.natServerHost = natServerHost;
......@@ -38,6 +39,10 @@ public class EchoClient {
this.clientId = clientId;
}
public void setAdminAccount(String adminAccount) {
this.adminAccount = adminAccount;
}
private Bootstrap echoClientBootstrap;
private Bootstrap echoClientToRealServerBootstrap;
......@@ -226,6 +231,11 @@ public class EchoClient {
EchoPacket proxyMessage = new EchoPacket();
proxyMessage.setType(PacketCommon.C_TYPE_REGISTER);
proxyMessage.setExtra(clientId);
if (adminAccount != null && !adminAccount.trim().isEmpty()) {
//注册的时候,添加账户身份。这样后台标记这个客户端属于那个客户端
//如果没有登录,或者不设置。那么成为无用户组资源
proxyMessage.setData(adminAccount.getBytes(StandardCharsets.UTF_8));
}
natChannel.writeAndFlush(proxyMessage);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment