|
4 | 4 | "context" |
5 | 5 | "crypto/x509" |
6 | 6 | "fmt" |
| 7 | + |
7 | 8 | "github.com/feast-dev/feast/sdk/go/protos/feast/serving" |
8 | 9 | "github.com/opentracing/opentracing-go" |
9 | 10 | "go.opencensus.io/plugin/ocgrpc" |
@@ -43,16 +44,25 @@ func NewGrpcClient(host string, port int) (*GrpcClient, error) { |
43 | 44 | }) |
44 | 45 | } |
45 | 46 |
|
46 | | -// NewAuthGrpcClient constructs a secure client that uses security features (ie authentication). |
| 47 | +// NewSecureGrpcClient constructs a secure client that uses security features (ie authentication). |
47 | 48 | // host - hostname of the serving host/instance to connect to. |
48 | 49 | // port - post of the host to service host/instancf to connect to. |
49 | 50 | // securityConfig - security config configures client security. |
50 | 51 | func NewSecureGrpcClient(host string, port int, security SecurityConfig) (*GrpcClient, error) { |
| 52 | + return NewSecureGrpcClientWithDialOptions(host, port, security) |
| 53 | +} |
| 54 | + |
| 55 | +// NewSecureGrpcClientWithDialOptions constructs a secure client that uses security features (ie authentication) along with custom grpc dial options. |
| 56 | +// host - hostname of the serving host/instance to connect to. |
| 57 | +// port - post of the host to service host/instancf to connect to. |
| 58 | +// securityConfig - security config configures client security. |
| 59 | +// opts - grpc.DialOptions which should be used with this connection |
| 60 | +func NewSecureGrpcClientWithDialOptions(host string, port int, security SecurityConfig, opts ...grpc.DialOption) (*GrpcClient, error) { |
51 | 61 | feastCli := &GrpcClient{} |
52 | 62 | adr := fmt.Sprintf("%s:%d", host, port) |
53 | 63 |
|
54 | 64 | // Compile grpc dial options from security config. |
55 | | - options := []grpc.DialOption{grpc.WithStatsHandler(&ocgrpc.ClientHandler{})} |
| 65 | + options := append(opts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{})) |
56 | 66 | // Configure client TLS. |
57 | 67 | if !security.EnableTLS { |
58 | 68 | options = append(options, grpc.WithInsecure()) |
|
0 commit comments