Documentation ¶ Overview ¶ 功能:client 说明: 功能:定义 说明: 功能:server 说明: Index ¶ Constants func NewClient(service_name string, addr1 string, addr2 string) error func NewServer(service_name string, addr string) error type Args type Deposit func (d *Deposit) Top_up(ctx context.Context, args *Args, reply *Reply) error type Reply Constants ¶ View Source const ( TCP = "tcp" ) Variables ¶ This section is empty. Functions ¶ func NewClient ¶ func NewClient(service_name string, addr1 string, addr2 string) error func NewServer ¶ func NewServer(service_name string, addr string) error addr形式: "localhost:8972" Types ¶ type Args ¶ type Args struct { Top_up_amount float64 // 充值额度 User_id string //用户id } type Deposit ¶ type Deposit int func (*Deposit) Top_up ¶ func (d *Deposit) Top_up(ctx context.Context, args *Args, reply *Reply) error 充值 type Reply ¶ type Reply struct { OK bool //是否成功 } Source Files ¶ View all Source files client.go define.go server.go Click to show internal directories. Click to hide internal directories.