client.go 509 B

1234567891011121314151617181920212223
  1. package v1
  2. import (
  3. "context"
  4. "go-common/library/net/rpc/warden"
  5. "google.golang.org/grpc"
  6. )
  7. //AppID 直播风控服务discoverID
  8. const AppID = "live.riskcontrol"
  9. //NewClient 直播风控服务client创建
  10. func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (IsForbiddenClient, error) {
  11. client := warden.NewClient(cfg, opts...)
  12. conn, err := client.Dial(context.Background(), "discovery://detault/"+AppID)
  13. if err != nil {
  14. return nil, err
  15. }
  16. return NewIsForbiddenClient(conn), nil
  17. }