gRPC

Procedure

  1. Edit the chassis.yaml file to enable the gRPC proxy. By default, the proxy is enabled.

    cse:
      protocols:
        grpc:
          listenAddress: 127.0.0.1:40101
        http:
          listenAddress: 127.0.0.1:30101

  2. Add a customized dialer to adapt to application code.

    Assume that the previous code is:

    conn,err:=grpc.Dial("10.0.1.1:50051",grpc.WithInsecure(),)
    The code needs to be modified to:
     //target address is consist of the provider name(in that case "Server") and provider port
    conn, err := grpc.Dial("Server:50051",   
         grpc.WithInsecure(),   
         grpc.WithDialer(func(addr string, time time.Duration) (net.Conn, error) {      
               //127.0.0.1:40101 is local grpc proxy address      
               return net.DialTimeout("tcp", "127.0.0.1:40101", time)   
    }))

  3. Deploy Mesher and applications.