Fix lint error

This commit is contained in:
Kristoffer Dalby 2021-10-29 17:36:11 +00:00
parent 9ef031f0f8
commit 72fd2a2780

View file

@ -282,9 +282,11 @@ func getHeadscaleApp() (*headscale.Headscale, error) {
} }
func getHeadscaleGRPCClient() (apiV1.HeadscaleServiceClient, *grpc.ClientConn) { func getHeadscaleGRPCClient() (apiV1.HeadscaleServiceClient, *grpc.ClientConn) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
grpcOptions := []grpc.DialOption{ grpcOptions := []grpc.DialOption{
// TODO(kradalby): Make configurable // TODO(kradalby): Make configurable
grpc.WithTimeout(5 * time.Second),
grpc.WithBlock(), grpc.WithBlock(),
} }
@ -329,7 +331,7 @@ func getHeadscaleGRPCClient() (apiV1.HeadscaleServiceClient, *grpc.ClientConn) {
} }
log.Trace().Caller().Str("address", address).Msg("Connecting via gRPC") log.Trace().Caller().Str("address", address).Msg("Connecting via gRPC")
conn, err := grpc.Dial(address, grpcOptions...) conn, err := grpc.DialContext(ctx, address, grpcOptions...)
if err != nil { if err != nil {
log.Fatal().Err(err).Msgf("Could not connect: %v", err) log.Fatal().Err(err).Msgf("Could not connect: %v", err)
} }