README.md 1.45 KB
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# example
插件客户端和服务端交互实例

# 用法
分为server和client,直接编译运行即可

server
```
$ cd server
$ go build
$ ./server
2023-08-04 19:29:58 [INFO] server.go:30 recv file header: UUID:"e4b1336d-3f13-4560-8a05-1d3d780b378b" Timestamp:1691148598 From:"test-plugin" To:"agent" Func:"SendFile" 
2023-08-04 19:29:58 [INFO] server.go:31 recv file name:client, purpose:testdata, size:12447406, path:/tmp/plugin2316397492
```

client
```
$ cd client
$ go build
$ ./client
2023-08-04 19:29:58 [INFO] client.go:29 Call req header: UUID:"ef30b661-dfb1-462b-ae88-c3667014c323" Timestamp:1691148598 From:"agent" To:"test-plugin" Func:"Ping" 
2023-08-04 19:29:58 [INFO] client.go:30 Call req data: ping
2023-08-04 19:29:58 [INFO] client.go:38 Call res header: UUID:"ef30b661-dfb1-462b-ae88-c3667014c323" Timestamp:1691148598 From:"test-plugin" To:"agent" Func:"Ping" 
2023-08-04 19:29:58 [INFO] client.go:39 Call res code:0, desc:success, data:pong
2023-08-04 19:29:58 [INFO] client.go:45 SendFile req header: UUID:"e4b1336d-3f13-4560-8a05-1d3d780b378b" Timestamp:1691148598 From:"agent" To:"test-plugin" Func:"SendFile" 
2023-08-04 19:29:58 [INFO] client.go:46 SendFile req name:client, purpose:testdata
2023-08-04 19:29:58 [INFO] client.go:54 SendFile res header: UUID:"e4b1336d-3f13-4560-8a05-1d3d780b378b" Timestamp:1691148598 From:"test-plugin" To:"agent" Func:"SendFile" 
2023-08-04 19:29:58 [INFO] client.go:55 SendFile res code:0, desc:success, data:
```