Alias

This plugin can alias a service and its method.

Client can use alias to call the service:

  1. flag.Parse()
  2. d := client.NewPeer2PeerDiscovery("tcp@"+*addr, "")
  3. option.ReadTimeout = 10 * time.Second
  4. defer xclient.Close()
  5. args := &example.Args{
  6. A: 10,
  7. B: 20,
  8. err := xclient.Call(context.Background(), "Times", args, reply)
  9. if err != nil {
  10. log.Fatalf("failed to call: %v", err)
  11. }
  12. log.Printf("%d * %d = %d", args.A, args.B, reply.C)

原文: