support RpcClient Vertify With Unilateralism and Mutual (#647)

Co-authored-by: Kevin Wan <wanjunfeng@gmail.com>
This commit is contained in:
workman-Lu
2021-10-30 22:07:15 +08:00
committed by GitHub
parent bef5bd4e4f
commit 9df6786b09
5 changed files with 69 additions and 2 deletions

View File

@@ -18,6 +18,12 @@ var (
WithRetry = internal.WithRetry
// WithUnaryClientInterceptor is an alias of internal.WithUnaryClientInterceptor.
WithUnaryClientInterceptor = internal.WithUnaryClientInterceptor
// WithInsecure is an alias of internal.WithInsecure.
WithInsecure = internal.WithInsecure
// WithTlsClientFromUnilateralism is an alias of internal.WithTlsClientFromUnilateralism
WithTlsClientFromUnilateralism = internal.WithTlsClientFromUnilateralism
// WithTlsClientFromMutual is an alias of internal.WithTlsClientFromMutual
WithTlsClientFromMutual = internal.WithTlsClientFromMutual
)
type (
@@ -58,6 +64,9 @@ func NewClient(c RpcClientConf, options ...ClientOption) (Client, error) {
opts = append(opts, WithRetry())
}
opts = append(opts, options...)
if !c.HasSslVerify() {
opts = append(opts, WithInsecure())
}
var target string
var err error