From 87836284e19e2c449c8b2acb4b5b5e9680cc6466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KagurazakaMiyabi=20=28=E7=A5=9E=E6=A5=BD=E5=9D=82=E9=9B=85?= =?UTF-8?q?=E8=A9=A9=29?= Date: Sun, 26 May 2024 20:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- Dockerfile | 6 +- Info.plist | 8 +- LICENSE | 2 +- MQTTDeviceTestingTool.desktop | 10 +- ...t.service => MQTTDeviceTestingTool.service | 4 +- README.md | 82 +++---------- docker.sh | 11 +- go.mod | 23 ++-- go.sum | 114 ++++++++++++++---- i18n.go | 4 +- main.go | 15 ++- versioninfo.json | 2 +- 13 files changed, 151 insertions(+), 132 deletions(-) rename mqtttestclient.service => MQTTDeviceTestingTool.service (60%) diff --git a/.gitignore b/.gitignore index 9a1be45..236ee9c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ mqtt-test-server *.crt *.key auth.json -macOS/mqttclienttesttool/MqttClientTestTool_macOS64 +macOS/mqttdevicetestingtool/MQTTDeviceTestingTool_macOS64 # Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,csharp,visualstudio,visualstudiocode,go diff --git a/Dockerfile b/Dockerfile index 51f7649..6a8f8ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:latest WORKDIR /root -COPY ./MqttClientTestTool_v1.5.5_Linux64 ./mqttclienttesttool -RUN chmod +x ./mqttclienttesttool -ENTRYPOINT ["./mqttclienttesttool"] +COPY ./MQTTDeviceTestingTool ./MQTTDeviceTestingTool +RUN chmod +x ./MQTTDeviceTestingTool +ENTRYPOINT ["./MQTTDeviceTestingTool"] diff --git a/Info.plist b/Info.plist index be607c6..2c692f4 100644 --- a/Info.plist +++ b/Info.plist @@ -3,11 +3,15 @@ CFBundleExecutable - MqttClientTestTool_macOS64 + MQTTDeviceTestingTool_macOS64 CFBundleIconFile icon.icns CFBundleIdentifier - com.tongdy.mqttclienttesttool + com.tongdy.mqttdevicetestingtool + CFBundleShortVersionString + 1.5.5 + CFBundleVersion + 155 NSHighResolutionCapable LSUIElement diff --git a/LICENSE b/LICENSE index af13ab5..4ed26e2 100644 --- a/LICENSE +++ b/LICENSE @@ -52,7 +52,7 @@ 3,请将如下声明文本放入每个源文件的头部注释中。 -Copyright (c) 2022 KagurazakaYashi@Tongdy MqttClientTestTool is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. +Copyright (c) 2022 KagurazakaYashi@Tongdy MQTTDeviceTestingTool is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. January 2020 http://license.coscl.org.cn/MulanPSL2 diff --git a/MQTTDeviceTestingTool.desktop b/MQTTDeviceTestingTool.desktop index 22e6e2b..5816f56 100644 --- a/MQTTDeviceTestingTool.desktop +++ b/MQTTDeviceTestingTool.desktop @@ -1,15 +1,15 @@ [Desktop Entry] Type=Application -Version=1.0 -Name=MqttClientTestTool -GenericName=Mqtt Client Test Tool +Version=1.5.5 +Name=MQTTDeviceTestingTool +GenericName=MQTT Device Testing Tool GenericName[zh_CN]=MQTT 客户端测试工具 GenericName[zh_TW]=MQTT 客戶端測試工具 -Comment=Mqtt Client Test Tool +Comment=MQTT Device Testing Tool Comment[zh_CN]=这个工具可以帮助您测试设备的 MQTT 连接的稳定性。 Comment[zh_TW]=這個工具可以幫助您測試裝置的 MQTT 連線的穩定性。 Icon=icon.png -Exec=MqttClientTestTool_v1.5.5_Linux64 +Exec=MQTTDeviceTestingTool Terminal=true Categories=Application;Network; Keywords=mqtt; diff --git a/mqtttestclient.service b/MQTTDeviceTestingTool.service similarity index 60% rename from mqtttestclient.service rename to MQTTDeviceTestingTool.service index 9eb6145..e400576 100644 --- a/mqtttestclient.service +++ b/MQTTDeviceTestingTool.service @@ -1,9 +1,9 @@ [Unit] -Description=MQTT Client Test Tool +Description=MQTT Device Testing Tool After=network.target [Service] -ExecStart=/root/MqttClientTestTool_v1.5.5_Linux64 +ExecStart=/root/MQTTDeviceTestingTool WorkingDirectory=/root/ Restart=always User=root diff --git a/README.md b/README.md index 9279235..e54feeb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -![icon](macOS/mqttclienttesttool/AppIcon.xcassets/AppIcon.appiconset/MQTT%20client%20test%20tool%205.png) +![icon](ico/icon.ico) -# [MQTT Client Test Tool](https://github.com/tongdysoft/mqtt-test-server) +# [MQTT Device Testing Tool](https://github.com/tongdysoft/mqtt-test-server) [ English | [中文](#mqtt-客户端测试工具)] @@ -17,16 +17,6 @@ This tool can help you test the stability of your device's MQTT connection. Download the program from [Release](releases). No installation required. -| Release files (Archive) | OS | >=ver | BC | Arch | -| ------------------------ | ------- | ----- | --- | ------------------- | -| `bin/*_Linux32.zip` | Linux | 2.6 | 32 | i386 (x86) | -| `bin/*_Linux64.zip` | Linux | 2.6 | 64 | amd64(x86-64) | -| `bin/*_macOS64.dmg` | macOS | 10.13 | 64 | amd64(x86-64) | -| `bin/*_macOSARM64.dmg` | macOS | 11 | 64 | arm64(AppleSilicon) | -| `bin/*_Windows32.cab` | Windows | 7 | 32 | i386 (x86) | -| `bin/*_Windows64.cab` | Windows | 7 | 64 | amd64(x86-64) | -| `bin/*_WindowsARM64.cab` | Windows | 10 | 64 | arm64(aarch64) | - Non-Windows systems need to use `chmod +x ` to add permission to run. ### Docker @@ -36,21 +26,21 @@ Non-Windows systems need to use `chmod +x ` to add permiss ### Linux systemd -1. Copy `mqtttestclient.service` to `/etc/systemd/system/` -2. Modify the path and start user in `/etc/systemd/system/mqtttestclient.service` -3. `sudo systemctl start mqtttestclient.service` +1. Copy `MQTTDeviceTestingTool.service` to `/etc/systemd/system/` +2. Modify the path and start user in `/etc/systemd/system/MQTTDeviceTestingTool.service` +3. `sudo systemctl start MQTTDeviceTestingTool.service` ### Linux desktop shortcuts -1. Copy `mqttclienttesttool.desktop` to `~/Desktop` -2. Modify the execution file and icon path in `~/Desktop/mqttclienttesttool.desktop` +1. Copy `MQTTDeviceTestingTool.desktop` to `~/Desktop` +2. Modify the execution file and icon path in `~/Desktop/MQTTDeviceTestingTool.desktop` ## Usage Command: mqtt-test-server `< -l .. | -p .. | -u .. | -ca .. | -ce .. | ck .. | cp .. | cv .. | -c .. | -t .. | -w .. | -d .. | -s .. | -o .. | -ts | -n | -v >` - `-l string` - - Language ( `en(default) | cn` ) + - Language ( `en(default) | chs` ) - `-p string` - Define listening on IP:Port (default: `0.0.0.0:1883` ) - To allow all IP addresses: `:1883` @@ -130,18 +120,6 @@ acl: '#': 3 ``` -### Use in macOS - -Before running this `.app` program directly, make sure that `Terminal.app` is in an exited state. - -#### Add startup parameters in macOS system - -1. Open the `.dmg` file of the corresponding platform in Release, find the `.app` file inside, and copy it to the `Applications` folder. -2. Right click on the `.app` file and select `Show Package Contents`. -3. Edit the `Contents/Resources/run.sh` script file, and add parameters at the comment position. - -The `Contents/Resources/MqttClientTestTool_macOS64` file can be extracted separately and run in the terminal. - ## Build ```sh @@ -158,7 +136,7 @@ Build all platforms under Windows: `build.bat` ## LICENSE -Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy](https://github.com/tongdysoft) MqttClientTestTool is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. +Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy](https://github.com/tongdysoft) MQTTDeviceTestingTool is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. ## Third-party @@ -174,7 +152,7 @@ Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy 这个工具可以帮助您测试设备的 MQTT 连接的稳定性。 - 版本: `1.5.5` -- golang 版本: `1.21.5` +- golang 版本: `1.22.3` ## 功能 @@ -184,16 +162,6 @@ Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy 从 [Release](releases) 下载相应系统的可执行文件即可,无需安装。 -| Release 文件(压缩包) | 系统 | 最低版 | 位 | 体系结构 | -| ------------------------ | ------- | ------ | --- | ------------------- | -| `bin/*_Linux32.zip` | Linux | 2.6 | 32 | i386 (x86) | -| `bin/*_Linux64.zip` | Linux | 2.6 | 64 | amd64(x86-64) | -| `bin/*_macOS64.dmg` | macOS | 10.13 | 64 | amd64(x86-64) | -| `bin/*_macOSARM64.dmg` | macOS | 11 | 64 | arm64(AppleSilicon) | -| `bin/*_Windows32.cab` | Windows | 7 | 32 | i386 (x86) | -| `bin/*_Windows64.cab` | Windows | 7 | 64 | amd64(x86-64) | -| `bin/*_WindowsARM64.cab` | Windows | 10 | 64 | arm64(aarch64) | - 非 Windows 系统需要使用 `chmod +x <解压缩后的可执行文件名>` 来添加运行权限。 ### Docker 部署 @@ -203,21 +171,21 @@ Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy ### Linux 系统服务 (systemd) -1. 复制 `mqtttestclient.service` 到 `/etc/systemd/system/` -2. 修改 `/etc/systemd/system/mqtttestclient.service` 中的路径和启动用户等 -3. `sudo systemctl start mqtttestclient.service` +1. 复制 `MQTTDeviceTestingTool.service` 到 `/etc/systemd/system/` +2. 修改 `/etc/systemd/system/MQTTDeviceTestingTool.service` 中的路径和启动用户等 +3. `sudo systemctl start MQTTDeviceTestingTool.service` ### Linux 桌面快捷方式 -1. 复制 `mqttclienttesttool.desktop` 到 `~/桌面` -2. 修改 `~/桌面/mqttclienttesttool.desktop` 中的执行文件和图标路径 +1. 复制 `MQTTDeviceTestingTool.desktop` 到 `~/桌面` +2. 修改 `~/桌面/MQTTDeviceTestingTool.desktop` 中的执行文件和图标路径 ## 使用说明 命令行参数: mqtt-test-server `< -l .. | -p .. | -u .. | -ca .. | -ce .. | ck .. | cp .. | -cv .. | -c .. | -t .. | -w .. | -d .. | -s .. | -o .. | -ts | -n | -v >` - `-l 字符串` - - 语言 ( `en(英语,默认) | cn(简体中文)` ) + - 语言 ( `en(英语,默认) | chs(简体中文)` ) - `-p 字符串` - 指定要监听的地址和端口 (默认值: `0.0.0.0:1883` ) - 如需允许所有 IP 地址: `:1883` @@ -297,24 +265,6 @@ acl: '#': 3 ``` -### 在 macOS 中使用 - -在直接运行该 `.app` 程序之前,请确保 `终端.app` 处于退出状态。 - -#### 添加启动参数 - -在直接运行该 `.app` 程序之前,请确保 `终端.app` 处于退出状态。 - -1. 打开 Release 中的相应平台的 `.dmg` 文件,找到里面的 `.app` 文件,将其复制到 `应用程序` 文件夹. -2. 右键点击改 `.app` 文件,选择 `显示包内容` 。 -3. 编辑 `Contents/Resources/run.sh` 脚本文件,在里面注释位置处添加参数。 - -可以将 `Contents/Resources/MqttClientTestTool_macOS64` 文件单独提取出来在终端中运行。 - -### Windows 系统中使用中文交互模式 - -可以将 `InteractiveModeCHS.bat` 和 exe 放在一起,双击启动中文交互模式,无需关心命令行参数书写。 - ## 编译 ```sh diff --git a/docker.sh b/docker.sh index ac20291..ef283ec 100644 --- a/docker.sh +++ b/docker.sh @@ -1,6 +1,5 @@ -unzip MqttClientTestTool_v1.5.5_Linux64.zip -docker stop mqttclienttesttool -docker rm mqttclienttesttool -docker rmi mqttclienttesttool -docker build -t mqttclienttesttool . -docker run -it -p 1883:1883 --name mqttclienttesttool -d mqttclienttesttool +docker stop MQTTDeviceTestingTool +docker rm MQTTDeviceTestingTool +docker rmi MQTTDeviceTestingTool +docker build -t MQTTDeviceTestingTool . +docker run -it -p 1883:1883 --name MQTTDeviceTestingTool -d MQTTDeviceTestingTool diff --git a/go.mod b/go.mod index 340cf69..1b02098 100644 --- a/go.mod +++ b/go.mod @@ -1,28 +1,25 @@ -module github.com/tongdysoft/mqtt-test-server +module github.com/tongdysoft/MQTTDeviceTestingTool -go 1.21 - -toolchain go1.21.5 +go 1.22.3 require ( + github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 github.com/logrusorgru/aurora v2.0.3+incompatible - github.com/mochi-co/mqtt v1.3.2 ) require ( - github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - golang.org/x/sys v0.15.0 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.33.1 // indirect + golang.org/x/sys v0.20.0 // indirect ) require ( - github.com/akavel/rsrc v0.10.2 // indirect - github.com/fatih/color v1.16.0 + github.com/fatih/color v1.17.0 github.com/gorilla/websocket v1.5.1 // indirect - github.com/josephspurrier/goversioninfo v1.4.0 // indirect - github.com/mattn/go-colorable v0.1.13 - github.com/mochi-mqtt/server/v2 v2.4.4 + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mochi-mqtt/server/v2 v2.6.4 github.com/rs/xid v1.5.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 22e2016..4e98544 100644 --- a/go.sum +++ b/go.sum @@ -1,45 +1,111 @@ -github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= -github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuijfIjZyjZaHq9xDUh0tNitwXshJpbLkqMOJv4H3do= github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.2.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8= -github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= +github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mochi-co/mqtt v1.2.3 h1:u2sMD0wzK3bltkrL08bjhNleshgBp9L8F7aKdHIwB2I= -github.com/mochi-co/mqtt v1.2.3/go.mod h1:o0lhQFWL8QtR1+8a9JZmbY8FhZ89MF8vGOGHJNFbCB8= -github.com/mochi-co/mqtt v1.3.2 h1:cRqBjKdL1yCEWkz/eHWtaN/ZSpkMpK66+biZnrLrHC8= -github.com/mochi-co/mqtt v1.3.2/go.mod h1:o0lhQFWL8QtR1+8a9JZmbY8FhZ89MF8vGOGHJNFbCB8= -github.com/mochi-mqtt/server/v2 v2.4.4 h1:Xvgz7l1kVY/rNnUj5yx7m8tiwKs0WGfqKMwSnBLAWpM= -github.com/mochi-mqtt/server/v2 v2.4.4/go.mod h1:M1lZnLbyowXUyQBIlHYlX1wasxXqv/qFWwQxAzfphwA= +github.com/mochi-mqtt/server/v2 v2.6.4 h1:zuKokG/YzmefLecpodu1VSOSXJf1GP9mk2LdVcp1Jp4= +github.com/mochi-mqtt/server/v2 v2.6.4/go.mod h1:TqztjKGO0/ArOjJt9x9idk0kqPT3CVN8Pb+l+PS5Gdo= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/i18n.go b/i18n.go index 4d8ac3d..72aa661 100644 --- a/i18n.go +++ b/i18n.go @@ -1,7 +1,7 @@ package main var langs map[string][]string = map[string][]string{ - "TITLE": {"MQTT Client test tool", "MQTT 客户端测试工具"}, + "TITLE": {"MQTT Device Testing Tool", "MQTT 客户端测试工具"}, "HELP": {"For help, visit README.md . Web:", "如需帮助,请参阅 README.md 。在线指南:"}, "BOOTING": {"Starting MQTT server...", "正在启动 MQTT 服务器..."}, "START": {"service start", "服务启动"}, @@ -46,7 +46,7 @@ func lang(title string) string { return "?" + title + "?" } switch language { - case "cn": + case "chs": return langs[title][1] } return langs[title][0] diff --git a/main.go b/main.go index 74b9bae..da90a70 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -//go:generate goversioninfo -icon=ico/icon.ico -manifest=main.exe.manifest +//go:generate goversioninfo -icon=ico/icon.ico -manifest=main.exe.manifest -arm=true package main import ( @@ -65,7 +65,7 @@ func main() { ) // 初始化启动参数 flag.BoolVar(&versionView, "v", false, "Print version info") - flag.StringVar(&language, "l", "auto", "Language ( en | cn )") + flag.StringVar(&language, "l", "auto", "Language ( en | chs )") flag.StringVar(&listen, "p", "0.0.0.0:1883", "Define listening on IP:Port (default: 0.0.0.0:1883 )") flag.StringVar(&onlyID, "c", "", "Only allow these client IDs (comma separated)") flag.StringVar(&onlyTopic, "t", "", "Only allow these topics (comma separated)") @@ -87,11 +87,11 @@ func main() { syslang, _ := jibber_jabber.DetectIETF() if len(syslang) > 0 { if strings.Contains(syslang, "zh") { - language = "cn" + language = "chs" } } } - logPrint("I", lang("TITLE")+" v"+version+" for "+runtime.GOOS+" (KagurazakaYashi@Tongdy, 2023)") + logPrint("I", lang("TITLE")+" v"+version+" for "+runtime.GOOS+" (KagurazakaYashi@Tongdy, 2024)") logPrint("I", lang("HELP")+" https://github.com/tongdysoft/mqtt-test-server") // 初始化设置 if versionView { @@ -216,11 +216,14 @@ acl: } var tcp *listeners.TCP if useTLS { - tcp = listeners.NewTCP(listen, listen, &listeners.Config{ + tcp = listeners.NewTCP(listeners.Config{ + Address: listen, TLSConfig: tlsConfig, }) } else { - tcp = listeners.NewTCP(listen, listen, nil) + tcp = listeners.NewTCP(listeners.Config{ + Address: listen, + }) } err = server.AddListener(tcp) if err != nil { diff --git a/versioninfo.json b/versioninfo.json index f04802c..e8d7723 100644 --- a/versioninfo.json +++ b/versioninfo.json @@ -28,7 +28,7 @@ "LegalTrademarks": "Tongdy", "OriginalFilename": "main.exe", "PrivateBuild": "", - "ProductName": "MQTT client test tool", + "ProductName": "MQTT Device Testing Tool", "ProductVersion": "1.5.5.0", "SpecialBuild": "" },