From a976e5fc89cef80be0bdbfde3ec9a2ce8fe5e72e Mon Sep 17 00:00:00 2001 From: xc Date: Thu, 21 Aug 2025 14:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=BE=93=E5=87=BA=E4=BA=8C?= =?UTF-8?q?=E8=BF=9B=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aufs/core/sysmonitor.go | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/aufs/core/sysmonitor.go b/aufs/core/sysmonitor.go index d38c36d..2c711c3 100644 --- a/aufs/core/sysmonitor.go +++ b/aufs/core/sysmonitor.go @@ -2,7 +2,7 @@ package core import ( "aufs/proto/pb" - "encoding/json" + "encoding/base64" "fmt" "log" "net/http" @@ -108,19 +108,26 @@ func SysMonitor(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) } + // ver:0821 + // 输出proto + encdata := base64.StdEncoding.EncodeToString(hdinfo) + w.Header().Set("content-type", "application/x-protobuf") + w.Write([]byte(encdata)) + // make json string - jsondata, err := json.Marshal(hdinfo) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - w.Header().Set("Content-Type", "application/json") + // jsondata, err := json.Marshal(hdinfo) + // if err != nil { + // http.Error(w, err.Error(), http.StatusInternalServerError) + // } + + // w.Header().Set("Content-Type", "application/json") // 生成json数据 - jsondata, err = json.Marshal(SysResp{ - Status: 0, - Message: "success", - Data: hdinfo, - }) + // jsondata, err = json.Marshal(SysResp{ + // Status: 0, + // Message: "success", + // Data: hdinfo, + // }) // - w.Write(jsondata) + // w.Write(jsondata) }