代码拉取完成,页面将自动刷新
// Package example defines datastructure and services.
package example
import (
"context"
"fmt"
_ "github.com/shirou/gopsutil/v3/mem"
)
type Args struct {
A int
B int
}
type Reply struct {
// C int
C map[string]string
}
type Arith int
// func (t *Arith) Mul(ctx context.Context, args *Args, reply *Reply) error {
// reply.C = args.A * args.B
// fmt.Printf("call: %d * %d = %d\n", args.A, args.B, reply.C)
// return nil
// }
// func (t *Arith) Add(ctx context.Context, args *Args, reply *Reply) error {
// reply.C = args.A + args.B
// fmt.Printf("call: %d + %d = %d\n", args.A, args.B, reply.C)
// return nil
// }
func (t *Arith) Chen(ctx context.Context, args *Args, reply *Reply) error {
// v, _ := mem.VirtualMemory()
// reply.C = args.A + args.B
// fmt.printf(int(v.UsedPercent))
// result := HostAll
// m := map[string]string{
// "host":"192.168.0.1",
// "cpu":"80",
// "mem":"160",
// }
// reply.C := Host
reply.C = GetHostAll()
fmt.Printf("Chen--v1.1.4-cache-: %d + %d\n", args.A, args.B)
fmt.Println(reply.C)
return nil
}
func (t *Arith) Say(ctx context.Context, args *string, reply *string) error {
*reply = "hello " + *args
return nil
}
type Greeter struct{}
func (s *Greeter) Say(ctx context.Context, name *string, reply *string) error {
*reply = fmt.Sprintf("hello %s!", *name)
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。