mirror of
https://github.com/iLoveElysia/openbilibili.git
synced 2026-06-07 21:48:31 -05:00
26 lines
591 B
Go
26 lines
591 B
Go
|
|
package v1
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
|
||
|
|
"go-common/library/net/rpc/warden"
|
||
|
|
|
||
|
|
context "golang.org/x/net/context"
|
||
|
|
grpc "google.golang.org/grpc"
|
||
|
|
)
|
||
|
|
|
||
|
|
// AppID .
|
||
|
|
const AppID = "vipinfo.service"
|
||
|
|
|
||
|
|
// NewClient new grpc client
|
||
|
|
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (VipInfoClient, error) {
|
||
|
|
client := warden.NewClient(cfg, opts...)
|
||
|
|
cc, err := client.Dial(context.Background(), fmt.Sprintf("discovery://default/%s", AppID))
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return NewVipInfoClient(cc), nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ${GOPATH}/bin/warden -name=VipInfo -proto-package=account.vipinfo -dir service
|