Documentation ¶
Index ¶
- Constants
- func SetupLocal(mc *nacos.MetaConfig, data string, servers ...*nacos.ServerItem)
- type GrpcHandlerFunc
- type GrpcStub
- func (stub *GrpcStub) Acc() acc.AccClient
- func (stub *GrpcStub) AuthHeaderRole(uuid, url, method string) bool
- func (stub *GrpcStub) AuthHeaderToken(token string) (string, string)
- func (stub *GrpcStub) Chat() chat.WgchatClient
- func (stub *GrpcStub) GenClient(svrkey, addr string, port int)
- func (stub *GrpcStub) Mea() mea.MeaClient
- func (stub *GrpcStub) ParseAndStart(data string) error
- func (stub *GrpcStub) ParseCerts(data string) error
- func (stub *GrpcStub) Pay() pay.WgpayClient
- func (stub *GrpcStub) StartGrpcServer()
- func (stub *GrpcStub) Webss() webss.WebssClient
Constants ¶
const ( SvrAcc = "accservice" // server name of AccService backend SvrMea = "measure" // server name of Measure backend SvrWss = "webss" // server name of WebSS backend SvrChat = "wgchat" // server name of WgChat backend SvrPay = "wgpay" // server name of WgPay backend )
Variables ¶
This section is empty.
Functions ¶
func SetupLocal ¶
func SetupLocal(mc *nacos.MetaConfig, data string, servers ...*nacos.ServerItem)
Parse certs to running as grpc server and update swagger routers, it will listen target services if you input them infos.
Types ¶
type GrpcHandlerFunc ¶
GrpcHandlerFunc grpc server handler for register
type GrpcStub ¶
type GrpcStub struct { Certs map[string]*nacos.GrpcCert // Grpc handler certs Clients map[string]any // Grpc client handlers // Global handler function to return grpc server handler SvrHandlerFunc GrpcHandlerFunc // contains filtered or unexported fields }
func (*GrpcStub) AuthHeaderRole ¶
Auth account role from http header
func (*GrpcStub) AuthHeaderToken ¶
Auth header token and return account uuid and password
func (*GrpcStub) Chat ¶
func (stub *GrpcStub) Chat() chat.WgchatClient
Return Wgchat grpc client, maybe null if not generate first
func (*GrpcStub) ParseAndStart ¶
Parse grpc certs from nacos configs and register local server as grpc server handler, then start and listen.
func (*GrpcStub) ParseCerts ¶
Parse all grpc certs from nacos config data, and cache to certs map
func (*GrpcStub) Pay ¶
func (stub *GrpcStub) Pay() pay.WgpayClient
Return Wgpay grpc client, maybe null if not generate first
func (*GrpcStub) StartGrpcServer ¶
func (stub *GrpcStub) StartGrpcServer()
Start and excute grpc server, you numst setup global grpc register handler first as follow.
`USAGE`
// set grpc server register handler stub := wrpc.Singleton() stub.SvrHandlerFunc = func(svr *grpc.Server) { proto.RegisterAccServer(svr, &(handler.Acc{})) } // parse grps certs before register stub.ParseCerts(data) // register local server as grpc server go stub.StartGrpcServer()
func (*GrpcStub) Webss ¶
func (stub *GrpcStub) Webss() webss.WebssClient
Return Webss grpc client, maybe null if not generate first