Merge pull request #67 from iamqizhao/master

rename the convenience function to set TLS creds
This commit is contained in:
Qi Zhao
2015-02-25 23:00:13 -08:00
5 changed files with 7 additions and 7 deletions

View File

@ -61,9 +61,9 @@ type dialOptions struct {
// credentials. // credentials.
type DialOption func(*dialOptions) type DialOption func(*dialOptions)
// WithClientTLS returns a DialOption which configures a TLS credentials // WithTransportCredentials returns a DialOption which configures a
// for connection. // connection level security credentials (e.g., TLS/SSL).
func WithClientTLS(creds credentials.TransportAuthenticator) DialOption { func WithTransportCredentials(creds credentials.TransportAuthenticator) DialOption {
return func(o *dialOptions) { return func(o *dialOptions) {
o.authOptions = append(o.authOptions, creds) o.authOptions = append(o.authOptions, creds)
} }

View File

@ -175,7 +175,7 @@ func main() {
} else { } else {
creds = credentials.NewClientTLSFromCert(nil, sn) creds = credentials.NewClientTLSFromCert(nil, sn)
} }
opts = append(opts, grpc.WithClientTLS(creds)) opts = append(opts, grpc.WithTransportCredentials(creds))
} }
conn, err := grpc.Dial(*serverAddr, opts...) conn, err := grpc.Dial(*serverAddr, opts...)
if err != nil { if err != nil {

View File

@ -5,7 +5,7 @@ As outlined <a href="https://github.com/grpc/grpc-common/blob/master/grpc-auth-s
# Enabling TLS on a gRPC client # Enabling TLS on a gRPC client
```Go ```Go
conn, err := grpc.Dial(serverAddr, grpc.WithClientTLS(credentials.NewClientTLSFromCert(nil, "")) conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""))
``` ```
# Enableing TLS on a gRPC server # Enableing TLS on a gRPC server

View File

@ -316,7 +316,7 @@ func main() {
} else { } else {
creds = credentials.NewClientTLSFromCert(nil, sn) creds = credentials.NewClientTLSFromCert(nil, sn)
} }
opts = append(opts, grpc.WithClientTLS(creds)) opts = append(opts, grpc.WithTransportCredentials(creds))
if *testCase == "compute_engine_creds" { if *testCase == "compute_engine_creds" {
opts = append(opts, grpc.WithPerRPCCredentials(credentials.NewComputeEngine())) opts = append(opts, grpc.WithPerRPCCredentials(credentials.NewComputeEngine()))
} else if *testCase == "service_account_creds" { } else if *testCase == "service_account_creds" {

View File

@ -220,7 +220,7 @@ func setUp(useTLS bool, maxStream uint32) (s *grpc.Server, tc testpb.TestService
if err != nil { if err != nil {
log.Fatalf("Failed to create credentials %v", err) log.Fatalf("Failed to create credentials %v", err)
} }
conn, err = grpc.Dial(addr, grpc.WithClientTLS(creds)) conn, err = grpc.Dial(addr, grpc.WithTransportCredentials(creds))
} else { } else {
conn, err = grpc.Dial(addr) conn, err = grpc.Dial(addr)
} }