Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
echo-lib-Deprecated
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
echo
echo-lib-Deprecated
Commits
99318efd
Commit
99318efd
authored
Jul 23, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备注册附加账户信息
parent
e4a64e1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
EchoClient.java
src/main/java/com/virjar/echo/nat/client/EchoClient.java
+11
-1
No files found.
src/main/java/com/virjar/echo/nat/client/EchoClient.java
View file @
99318efd
...
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment