generated from VLADIMIR/template
24 lines
524 B
Go
24 lines
524 B
Go
package tests
|
||
|
||
import (
|
||
"context"
|
||
"log"
|
||
"time"
|
||
|
||
pb "evening_detective/proto"
|
||
|
||
"google.golang.org/grpc"
|
||
)
|
||
|
||
func getClient() (pb.EveningDetectiveClient, func() error) {
|
||
conn, err := grpc.Dial("localhost:8080", grpc.WithInsecure())
|
||
if err != nil {
|
||
log.Fatalf("Не удалось подключиться к серверу: %v", err)
|
||
}
|
||
return pb.NewEveningDetectiveClient(conn), conn.Close
|
||
}
|
||
|
||
func getContext() (context.Context, context.CancelFunc) {
|
||
return context.WithTimeout(context.Background(), time.Second)
|
||
}
|