Browse Source

Address PR comments

pull/1780/head
Christopher Goes 7 years ago
parent
commit
45514a6013
No known key found for this signature in database GPG Key ID: E828D98232D328D3
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      grpcdb/client.go
  2. +2
    -2
      grpcdb/doc.go
  3. +2
    -2
      grpcdb/server.go

+ 1
- 1
grpcdb/client.go View File

@ -17,7 +17,7 @@ const (
// NewClient creates a gRPC client connected to the bound gRPC server at serverAddr.
// Use kind to set the level of security to either Secure or Insecure.
func NewClient(serverAddr string, serverCert string) (protodb.DBClient, error) {
func NewClient(serverAddr, serverCert string) (protodb.DBClient, error) {
creds, err := credentials.NewClientTLSFromFile(serverCert, "")
if err != nil {
return nil, err


+ 2
- 2
grpcdb/doc.go View File

@ -21,8 +21,8 @@ should use it, for functionality such as:
or
addr := ":8998"
cert := "server.crt"
key := "server.key"
cert := "server.crt"
key := "server.key"
go func() {
if err := grpcdb.ListenAndServe(addr, cert, key); err != nil {
log.Fatalf("BindServer: %v", err)


+ 2
- 2
grpcdb/server.go View File

@ -16,7 +16,7 @@ import (
// ListenAndServe is a blocking function that sets up a gRPC based
// server at the address supplied, with the gRPC options passed in.
// Normally in usage, invoke it in a goroutine like you would for http.ListenAndServe.
func ListenAndServe(addr string, cert string, key string, opts ...grpc.ServerOption) error {
func ListenAndServe(addr, cert, key string, opts ...grpc.ServerOption) error {
ln, err := net.Listen("tcp", addr)
if err != nil {
return err
@ -28,7 +28,7 @@ func ListenAndServe(addr string, cert string, key string, opts ...grpc.ServerOpt
return srv.Serve(ln)
}
func NewServer(cert string, key string, opts ...grpc.ServerOption) (*grpc.Server, error) {
func NewServer(cert, key string, opts ...grpc.ServerOption) (*grpc.Server, error) {
creds, err := credentials.NewServerTLSFromFile(cert, key)
if err != nil {
return nil, err


Loading…
Cancel
Save