feat 包命名规范
This commit is contained in:
24
net/grpc/grpcclient/client_gateway.go
Normal file
24
net/grpc/grpcclient/client_gateway.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package grpcclient
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/rspb"
|
||||
)
|
||||
|
||||
func GatewayNewClient(sid ...int64) (rspb.GatewayClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rspb.NewGatewayClient(c), nil
|
||||
}
|
||||
|
||||
func GatewayNewBroadcastClient() map[int64]rspb.GatewayClient {
|
||||
clientM := make(map[int64]rspb.GatewayClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = rspb.NewGatewayClient(conn)
|
||||
}
|
||||
return clientM
|
||||
}
|
||||
Reference in New Issue
Block a user