diff --git a/README.en.md b/README.en.md index 55a4e801a8f61a03a2df14441b1b7e31ef1bbd71..d4e2650a1aeeda9fdcbd579d143d1c12151e4bc6 100644 --- a/README.en.md +++ b/README.en.md @@ -3,15 +3,20 @@ ## Getting Started ### Download + https://gitee.com/lazycatcloud/hclient-cli/releases ### Set up + #### Linux/macOS + ```shell chmod +x ./hclient-cli-$os-$arch ./hclient-cli-$os-$arch ``` + #### Windows + ```powershell # You need to download https://www.wintun.net/builds/wintun-0.14.1.zip # Then unpack wintun.dll, and put it in the same directory as hclient-cli @@ -20,7 +25,12 @@ mv ./hclient-cli-$os-$arch ./hclient-cli-$os-$arch.exe ./hclient-cli-$os-$arch.exe ``` +#### Docker + +[Click here for the relevant instructions on starting the hclient](https://gitee.com/lazycatcloud/hclient-cli/blob/master/tools/README.en.md) + ### Manage your microserver + ```shell # Add your microserver curl -X POST --get --data-urlencode bname="$microserver_name" --data-urlencode uid="$username" --data-urlencode password="$password" http://127.0.0.1:7777/add_box @@ -39,12 +49,15 @@ curl http://127.0.0.1:7777/client_info ``` ### Access your microserver + With default parameter, you can access microserver with HTTP proxy: + ```shell curl -x http://127.0.0.1:61090 https://$microserver_name.heiyu.space ``` If you're using hclient-cli on Linux, you can add required capability, and launch it in TUN mode: + ```shell sudo setcap cap_net_admin=ep ./hclient-cli-$os-$arch ./hclient-cli-$os-$arch -tun @@ -55,16 +68,23 @@ curl https://$boxname.heiyu.space ``` ### FAQ + #### In TUN mode, hclient-cli exits right after launch (Linux) + Check your program has the required capability: + ```shell sudo getcap ./hclient-cli-$os-$arch ``` + Then check the filesystem is not mounted with nosuid: + ```shell mount | grep nosuid # Check if the directory hclient-cli-$os-$arch is in is mounted with nosuid ``` + Lastly you can manually load the TUN kernel module, and set up the device permission: + ```shell sudo modprobe tun sudo chmod 666 /dev/net/tun diff --git a/README.md b/README.md index 7b5caec322097d7d0e882e3b009b8f360d395efa..28d4d4f975496599392801b52d9908e3ebce7ea5 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ chmod +x ./hclient-cli-$os-$arch mv ./hclient-cli-$os-$arch ./hclient-cli-$os-$arch.exe ./hclient-cli-$os-$arch.exe ``` +启动(docker) + +[docke 启动hclient相关说明点这里](https://gitee.com/lazycatcloud/hclient-cli/blob/master/tools/README.md) ### 微服管理 启动后,可以通过调用HTTP API来进行添加微服等操作: diff --git a/tools/README.en.md b/tools/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..e82d602546603feac1bfe6b00dddad967f5c19dc --- /dev/null +++ b/tools/README.en.md @@ -0,0 +1,46 @@ +# Tools + +This directory offers several methods for quickly using the CLI. + +## cmd.sh + +This file is mainly used for managing the microserver, and it is basically one-to-one corresponding with the API for microserver management. +The usage method is as follows: + +``` +./cmd.sh sub_command +``` + +> "Sub_command" refers to the corresponding management interface name. + +## Building Docker Image + +Check the latest version tag. For example, the current latest version tag is 20250514. Then execute the following command to start the compilation. + +``` +./build.sh 20250514 +``` + +After compilation, an image named `hclient-cli:latest` can be obtained, and then this image can be used to start a container. + +> This image also includes `cmd.sh` within it, so you can directly use the command `/app/cmd.sh` in the container. +> Start the container +> Below is a Demo that starts the container using the proxy pattern. + +``` +docker run -itd \ +--name lazycat \ +--hostname lazycat_in_docker \ +--restart always \ +-p 127.0.0.1:7777:7777 \ +-p 127.0.0.1:61090:61090 -v /data/cfg:/app/cfg \ +hclient-cli:latest \ +/app/hclient-cli \ +-cfg "/app/cfg" \ +-api-addr "127.0.0.1:7777" \ +-http-addr "127.0.0.1:61090" ``` +``` + +> Please be careful not to expose your 7777 management port and 61090 proxy port to the global network. + +After the Demo container is started, the host machine can manage it via `127.0.0.1:7777` and access it through the proxy at `127.0.0.1:61090`.