|
|
|
@ -18,8 +18,6 @@ import ( |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/netutil/breaker" |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/rpc/warden/balancer/p2c" |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/rpc/warden/internal/status" |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/rpc/warden/resolver" |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/rpc/warden/resolver/direct" |
|
|
|
|
"github.com/bilibili/kratos/pkg/net/trace" |
|
|
|
|
xtime "github.com/bilibili/kratos/pkg/time" |
|
|
|
|
|
|
|
|
@ -156,8 +154,6 @@ func NewConn(target string, opt ...grpc.DialOption) (*grpc.ClientConn, error) { |
|
|
|
|
// NewClient returns a new blank Client instance with a default client interceptor.
|
|
|
|
|
// opt can be used to add grpc dial options.
|
|
|
|
|
func NewClient(conf *ClientConfig, opt ...grpc.DialOption) *Client { |
|
|
|
|
// Do not initialize in the registration, otherwise it may cause the resvoler in the business code to not register.
|
|
|
|
|
resolver.Register(direct.New()) |
|
|
|
|
c := new(Client) |
|
|
|
|
if err := c.SetConfig(conf); err != nil { |
|
|
|
|
panic(err) |
|
|
|
@ -171,8 +167,6 @@ func NewClient(conf *ClientConfig, opt ...grpc.DialOption) *Client { |
|
|
|
|
// DefaultClient returns a new default Client instance with a default client interceptor and default dialoption.
|
|
|
|
|
// opt can be used to add grpc dial options.
|
|
|
|
|
func DefaultClient() *Client { |
|
|
|
|
// Do not initialize in the registration, otherwise it may cause the resvoler in the business code to not register.
|
|
|
|
|
resolver.Register(direct.New()) |
|
|
|
|
_once.Do(func() { |
|
|
|
|
_defaultClient = NewClient(nil) |
|
|
|
|
}) |
|
|
|
|