yy549159265 commented on code in PR #3474:
URL: https://github.com/apache/hertzbeat/pull/3474#discussion_r2155080477


##########
hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/mqtt/CertificateFormatter.java:
##########
@@ -0,0 +1,184 @@
+package org.apache.hertzbeat.collector.collect.mqtt;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class CertificateFormatter {
+
+    /**
+     * 格式化证书字符串,支持处理多个证书
+     */
+    public static String formatCertificateChain(String input) {
+        if (input == null || input.trim().isEmpty()) {
+            return input;
+        }
+
+        // 标准化输入格式
+        String normalized = normalizeInput(input);
+
+        // 提取所有证书块
+        List<String> certificates = extractCertificates(normalized);
+
+        // 如果没有找到证书块,尝试作为纯内容处理
+        if (certificates.isEmpty()) {
+            return formatAsSingleCertificate(normalized);
+        }
+
+        // 格式化每个证书块
+        StringBuilder formattedChain = new StringBuilder();
+        for (String cert : certificates) {
+            // 防止空证书块

Review Comment:
   Thanks, I have re-used the English comments



##########
hertzbeat-common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/MqttProtocol.java:
##########
@@ -32,50 +32,29 @@
 @NoArgsConstructor
 public class MqttProtocol implements CommonRequestProtocol, Protocol {
 
-    /**
-     * ip address or domain name of the peer host
-     */
+    private String clientId;
+    private String username;
+    private String password;
     private String host;
-
-    /**
-     * peer host port
-     */
     private String port;
+    private String protocol;
+    private String timeout;
+    private String keepalive;
+    private String topic;
+    private String testMessage;
+    private String tlsVersion;
+    private String insecureSkipVerify;
+    private String caCert;
+    private String enableMutualAuth;
+    private String clientCert;
+    private String clientKey;

Review Comment:
   Thanks, I have re-used the English comments



##########
hertzbeat-collector/hertzbeat-collector-basic/pom.xml:
##########
@@ -139,11 +139,23 @@
             <version>${nacos-client.version}</version>
         </dependency>
         <!-- mqtt -->
-        <dependency>
-            <groupId>com.hivemq</groupId>
-            <artifactId>hivemq-mqtt-client</artifactId>
+        <!--        <dependency>-->
+        <!--            <groupId>com.hivemq</groupId>-->
+        <!--            <artifactId>hivemq-mqtt-client</artifactId>-->
+        <!--            <version>${mqtt.version}</version>-->
+        <!--        </dependency>-->
+        <!--        使用 paho mqtt client sdk-->
+        <dependency>
+            <groupId>org.eclipse.paho</groupId>
+            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
             <version>${mqtt.version}</version>
         </dependency>
+        <!--        证书 用来加密解密-->
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcpkix-jdk15on</artifactId>
+            <version>1.68</version>
+        </dependency>

Review Comment:
   Thanks, I have re-used the English comments



##########
hertzbeat-collector/hertzbeat-collector-basic/pom.xml:
##########
@@ -155,20 +167,9 @@
             <artifactId>plc4j-driver-modbus</artifactId>
             <version>0.12.0</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.plc4x</groupId>
-            <artifactId>plc4j-driver-s7</artifactId>
-            <version>0.12.0</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.sshd</groupId>
             <artifactId>sshd-sftp</artifactId>
         </dependency>
-        <!-- Zookeeper -->
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-            <version>${zookeeper.version}</version>
-        </dependency>
     </dependencies>

Review Comment:
   Hello, I found that my master is an old version and the pom file has been 
modified.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to