client.go 465 B

123456789101112131415161718192021222324
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package tests
  4. import (
  5. "log"
  6. "smart-alarm/pb"
  7. "google.golang.org/grpc"
  8. )
  9. var client pb.SmartSiteClient
  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.NewSmartSiteClient(conn)
  18. }