-
Notifications
You must be signed in to change notification settings - Fork 16
6.3. Hidden Lake Traffic
github.com/number571/go-peer/tree/master/cmd/hidden_lake/traffic;
The Hidden Lake Traffic
is an application that saves traffic passed through HLS. The saved traffic can be used by other applications when they were offline. HLT provides an API for loading and unloading messages. Messages are stored in the database based on the "ring" structure. Thus, new messages will overwrite the old ones after some time.
More information about HLT in the habr.com/ru/post/717184
HLT emulates HLS to receive messages. In this scenario, HLT has only the functions of accepting messages, without the ability to generate or send them via HLS or independently.
Figure 9. Example of running HLT client.
Default build and run
$ cd ./cmd/hidden_lake/traffic
$ make build # create hlt, hlt_linux, hlt_windows.exe and copy to ./bin
$ make run # run ./bin/hlt
> [INFO] 2023/06/03 15:39:13 HLT is running...
> ...
Open ports 9581
(HTTP, interface).
Creates ./hlt.cfg
or ./_mounted/hlt.cfg
(docker), ./hlt.db
or ./_mounted/hlt.db
(docker) files.
The file hlm.db
stores all sent/received messages as structure ring
from network HL.
Default config hlt.cfg
{
"logging": [
"info",
"warn",
"erro"
],
"address": ":9581",
"connection": "service:9571"
}
If traffic works not in docker's enviroment than need rewrite connection host in hlt.cfg
file from service
to IP address (example: 127.0.0.1:9571
for local network).
Build and run with docker
$ cd ./cmd/hidden_lake/traffic
$ make docker-build
$ make docker-run
> [INFO] 2023/06/03 08:44:14 HLT is running...
> ...
Build and run service
$ cd examples/_cmd/traffic_keeper
$ make
Run client
$ cd client
$ go run ./main.go w 'hello, world!'
$ go run ./main.go h
$ go run ./main.go r cb3c6558fe0cb64d0d2bad42dffc0f0d9b0f144bc24bb8f2ba06313af9297be4 # hash get by 'h' option