iloom/shared/pkg/grpc/client.go

19 lines
484 B
Go
Raw Normal View History

package grpc
import (
"fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
// Dial creates a gRPC client connection to the given address.
// Uses insecure credentials (no TLS) for internal service communication.
func Dial(addr string) (*grpc.ClientConn, error) {
conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, fmt.Errorf("grpc dial %s: %w", addr, err)
}
return conn, nil
}