client.go 460 B

123456789101112131415161718192021222324
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package tests
  4. import (
  5. "adm-task/pb"
  6. "log"
  7. "google.golang.org/grpc"
  8. )
  9. var client pb.GreeterClient
  10. const ServerAddr = "127.0.0.1:10001"
  11. func init() {
  12. // Set up a connection to the server.
  13. conn, err := grpc.Dial(ServerAddr, grpc.WithInsecure())
  14. if err != nil {
  15. log.Fatalf("did not connect: %v", err)
  16. }
  17. client = pb.NewGreeterClient(conn)
  18. }