optimization of tunnel server README.md (#1149)

pull/1413/head
华华 5 years ago committed by GitHub
parent 2204f50115
commit 3a12237d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,3 @@
## How it works
Tunnel server/client use websocket protocol.
@ -8,24 +6,36 @@ For example:
1. Arthas tunnel server listen at `192.168.1.10:7777`
1. Arthas tunnel client register to the tunnel server
2. Arthas tunnel client register to the tunnel server
tunnel client connect to tunnel server with URL: `ws://192.168.1.10:7777/ws?method=agentRegister`
tunnel client connect to tunnel server with URL: `ws://192.168.1.10:7777/ws?method=agentRegister`
tunnel server response a text frame message: `response:/?method=agentRegister&id=bvDOe8XbTM2pQWjF4cfw`
tunnel server response a text frame message: `response:/?method=agentRegister&id=bvDOe8XbTM2pQWjF4cfw`
This connection is `control connection`.
This connection is `control connection`.
3. The browser try connect to remote arthas agent
1. The browser try connect to remote arthas agent, start connect to tunnel server with URL: `'ws://192.168.1.10:7777/ws?method=connectArthas&id=bvDOe8XbTM2pQWjF4cfw`
start connect to tunnel server with URL: `'ws://192.168.1.10:7777/ws?method=connectArthas&id=bvDOe8XbTM2pQWjF4cfw`
1. Arthas server find the `control connection` with the id `bvDOe8XbTM2pQWjF4cfw`, then send a text frame to arthas client: `response:/?method=startTunnel&id=bvDOe8XbTM2pQWjF4cfw&clientConnectionId=AMku9EFz2gxeL2gedGOC`
4. Arthas server find the `control connection` with the id `bvDOe8XbTM2pQWjF4cfw`
then send a text frame to arthas client: `response:/?method=startTunnel&id=bvDOe8XbTM2pQWjF4cfw&clientConnectionId=AMku9EFz2gxeL2gedGOC`
1. Arhtas tunnel client open a new connection to tunnel server, URL: `ws://127.0.0.1:7777/ws/?method=openTunnel&clientConnectionId=AMku9EFz2gxeL2gedGOC&id=bvDOe8XbTM2pQWjF4cfw`. This connection is `tunnel connection`.
5. Arthas tunnel client open a new connection to tunnel server
1. Arhtas tunnel client start connect to local arthas agent, URL: `ws://127.0.0.1:3658/ws`. This connection is `local connection`.
URL: `ws://127.0.0.1:7777/ws/?method=openTunnel&clientConnectionId=AMku9EFz2gxeL2gedGOC&id=bvDOe8XbTM2pQWjF4cfw`
This connection is `tunnel connection`
1. Forward websocket frame between `tunnel connection` and `local connection`.
6. Arthas tunnel client start connect to local arthas agent, URL: `ws://127.0.0.1:3658/ws`
This connection is `local connection`
7. Forward websocket frame between `tunnel connection` and `local connection`.
```
+---------+ +----------------------+ +----------------------+ +--------------+
| browser <-----> arthas tunnel server | <-----> arthas tunnel client <--- -> arthas agent |
|---------+ +----------------------+ +----------------------+ +--------------+
```
browser <-> arthas tunnel server <-> arthas tunnel client <-> arthas agent
```
Loading…
Cancel
Save