Alias
This plugin can alias a service and its method.
Client can use alias to call the service:
flag.Parse()
d := client.NewPeer2PeerDiscovery("tcp@"+*addr, "")
option.ReadTimeout = 10 * time.Second
defer xclient.Close()
args := &example.Args{
A: 10,
B: 20,
err := xclient.Call(context.Background(), "Times", args, reply)
if err != nil {
log.Fatalf("failed to call: %v", err)
}
log.Printf("%d * %d = %d", args.A, args.B, reply.C)
原文: