自动更新管控端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
714 B

package core
import (
"fmt"
"net/http"
"net/rpc/jsonrpc"
)
// 文件操作
func Flist(w http.ResponseWriter, r *http.Request) {
// 获取需要监听的服务器
// sc := r.Form.Get("srcip")
// 测试JSONRPC
service := "192.168.66.92:9098"
client, err := jsonrpc.Dial("tcp", service)
if err != nil {
fmt.Fprintf(w, "jsonrpc dial faild %v", err)
return
}
// 调用远程方法
var reply string
var args = Args{"/www/wwwroot"}
err = client.Call("FileRpcService.GetFilePath", args, &reply)
if err != nil {
fmt.Fprintf(w, "jsonrpc call faild %v", err)
return
}
// 输出内容
w.Header().Set("Content-Type", "application/json")
// json.NewEncoder(w).Encode(dtm)
w.Write([]byte(reply))
}