|
|
|
@ -3,6 +3,7 @@ package core |
|
|
|
import ( |
|
|
|
"aufs/proto/pb" |
|
|
|
"encoding/base64" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"log" |
|
|
|
"net/http" |
|
|
|
@ -111,23 +112,23 @@ func SysMonitor(w http.ResponseWriter, r *http.Request) { |
|
|
|
// ver:0821
|
|
|
|
// 输出proto
|
|
|
|
encdata := base64.StdEncoding.EncodeToString(hdinfo) |
|
|
|
w.Header().Set("content-type", "application/x-protobuf") |
|
|
|
w.Write([]byte(encdata)) |
|
|
|
// 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)
|
|
|
|
// }
|
|
|
|
jsondata, err := json.Marshal(hdinfo) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
|
|
} |
|
|
|
|
|
|
|
// w.Header().Set("Content-Type", "application/json")
|
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
|
|
|
|
// 生成json数据
|
|
|
|
// jsondata, err = json.Marshal(SysResp{
|
|
|
|
// Status: 0,
|
|
|
|
// Message: "success",
|
|
|
|
// Data: hdinfo,
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// w.Write(jsondata)
|
|
|
|
jsondata, err = json.Marshal(SysResp{ |
|
|
|
Status: 0, |
|
|
|
Message: "success", |
|
|
|
Data: encdata, |
|
|
|
}) |
|
|
|
|
|
|
|
w.Write(jsondata) |
|
|
|
} |
|
|
|
|