|
|
|
@ -109,6 +109,12 @@ func WithLogger(log log.Logger) ClientOption { |
|
|
|
|
return func(o *clientOptions) {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func WithPrintDiscoveryDebugLog(p bool) ClientOption { |
|
|
|
|
return func(o *clientOptions) { |
|
|
|
|
o.printDiscoveryDebugLog = p |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// clientOptions is gRPC Client
|
|
|
|
|
type clientOptions struct { |
|
|
|
|
endpoint string |
|
|
|
@ -122,6 +128,7 @@ type clientOptions struct { |
|
|
|
|
grpcOpts []grpc.DialOption |
|
|
|
|
balancerName string |
|
|
|
|
filters []selector.NodeFilter |
|
|
|
|
printDiscoveryDebugLog bool |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Dial returns a GRPC connection.
|
|
|
|
@ -139,6 +146,7 @@ func dial(ctx context.Context, insecure bool, opts ...ClientOption) (*grpc.Clien |
|
|
|
|
timeout: 2000 * time.Millisecond, |
|
|
|
|
balancerName: balancerName, |
|
|
|
|
subsetSize: 25, |
|
|
|
|
printDiscoveryDebugLog: true, |
|
|
|
|
} |
|
|
|
|
for _, o := range opts { |
|
|
|
|
o(&options) |
|
|
|
@ -169,6 +177,7 @@ func dial(ctx context.Context, insecure bool, opts ...ClientOption) (*grpc.Clien |
|
|
|
|
options.discovery, |
|
|
|
|
discovery.WithInsecure(insecure), |
|
|
|
|
discovery.WithSubset(options.subsetSize), |
|
|
|
|
discovery.PrintDebugLog(options.printDiscoveryDebugLog), |
|
|
|
|
))) |
|
|
|
|
} |
|
|
|
|
if insecure { |
|
|
|
|