MCPcopy
hub / github.com/grpc/grpc-go / main

Function main

examples/features/interceptor/client/main.go:147–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147func main() {
148 flag.Parse()
149
150 // Create tls based credential.
151 creds, err := credentials.NewClientTLSFromFile(data.Path("x509/ca_cert.pem"), "x.test.example.com")
152 if err != nil {
153 log.Fatalf("failed to load credentials: %v", err)
154 }
155
156 // Set up a connection to the server.
157 conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(unaryInterceptor), grpc.WithStreamInterceptor(streamInterceptor))
158 if err != nil {
159 log.Fatalf("did not connect: %v", err)
160 }
161 defer conn.Close()
162
163 // Make an echo client and send RPCs.
164 rgc := ecpb.NewEchoClient(conn)
165 callUnaryEcho(rgc, "hello world")
166 callBidiStreamingEcho(rgc)
167}

Callers

nothing calls this directly

Calls 11

NewClientTLSFromFileFunction · 0.92
PathFunction · 0.92
NewClientFunction · 0.92
WithTransportCredentialsFunction · 0.92
WithUnaryInterceptorFunction · 0.92
WithStreamInterceptorFunction · 0.92
callUnaryEchoFunction · 0.70
callBidiStreamingEchoFunction · 0.70
ParseMethod · 0.65
FatalfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected