Skip to content

Commit d7d419c

Browse files
committed
client: always use transport credentials
1 parent f81af4e commit d7d419c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"crypto/tls"
56
"errors"
67
"fmt"
78
"net"
@@ -15,6 +16,7 @@ import (
1516
"git.sr.ht/~mpldr/uniview/protocol"
1617
"git.sr.ht/~poldi1405/glog"
1718
"google.golang.org/grpc"
19+
"google.golang.org/grpc/credentials"
1820
"google.golang.org/grpc/credentials/insecure"
1921
"google.golang.org/protobuf/types/known/durationpb"
2022
)
@@ -44,6 +46,8 @@ func startClient(u *url.URL) error {
4446
var opts []grpc.DialOption
4547
if u.Query().Has("insecure") || insecureByDefault(u.Hostname()) {
4648
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
49+
} else {
50+
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
4751
}
4852

4953
gconn, err := grpc.Dial(u.Host, opts...)

0 commit comments

Comments
 (0)