Alias

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