Skip to content

Commit

Permalink
grpc: migrate from DialContext to NewClient
Browse files Browse the repository at this point in the history
DialContext was deprecated in google.golang.org/[email protected]

Signed-off-by: Paul Meyer <[email protected]>
  • Loading branch information
katexochen committed Apr 8, 2024
1 parent 0811022 commit c453e13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/grpc/dialer/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ func NewWithKey(issuer atls.Issuer, validator atls.Validator, netDialer NetDiale
}

// Dial creates a new grpc client connection to the given target using the atls validator.
func (d *Dialer) Dial(ctx context.Context, target string) (*grpc.ClientConn, error) {
func (d *Dialer) Dial(_ context.Context, target string) (*grpc.ClientConn, error) {
var validators []atls.Validator
if d.validator != nil {
validators = append(validators, d.validator)
}
credentials := atlscredentials.NewWithKey(d.issuer, validators, d.privKey)

return grpc.DialContext(ctx, target,
return grpc.NewClient(target,
d.grpcWithDialer(),
grpc.WithTransportCredentials(credentials),
grpc.WithConnectParams(grpc.ConnectParams{
Expand All @@ -67,18 +67,18 @@ func (d *Dialer) Dial(ctx context.Context, target string) (*grpc.ClientConn, err

// DialInsecure creates a new grpc client connection to the given target without using encryption or verification.
// Only use this method when using another kind of encryption / verification (VPN, etc).
func (d *Dialer) DialInsecure(ctx context.Context, target string) (*grpc.ClientConn, error) {
return grpc.DialContext(ctx, target,
func (d *Dialer) DialInsecure(_ context.Context, target string) (*grpc.ClientConn, error) {
return grpc.NewClient(target,
d.grpcWithDialer(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
}

// DialNoVerify creates a new grpc client connection to the given target without verifying the server's attestation.
func (d *Dialer) DialNoVerify(ctx context.Context, target string) (*grpc.ClientConn, error) {
func (d *Dialer) DialNoVerify(_ context.Context, target string) (*grpc.ClientConn, error) {
credentials := atlscredentials.New(nil, nil)

return grpc.DialContext(ctx, target,
return grpc.NewClient(target,
d.grpcWithDialer(),
grpc.WithTransportCredentials(credentials),
)
Expand Down

0 comments on commit c453e13

Please sign in to comment.