1 Star 1 Fork 0

王金胜/best_rpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
bestrpc.go 962 Bytes
一键复制 编辑 原始数据 按行查看 历史
王金胜 提交于 2023-08-23 09:40 +08:00 . 新版7
package main
import (
"flag"
"fmt"
"gitee.com/wang-jinsheng/best_rpc/best_rpc"
"gitee.com/wang-jinsheng/best_rpc/internal/config"
"gitee.com/wang-jinsheng/best_rpc/internal/server"
"gitee.com/wang-jinsheng/best_rpc/internal/svc"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
var configFile = flag.String("f", "etc/bestrpc.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
best_rpc.RegisterBestRpcServer(grpcServer, server.NewBestRpcServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
defer s.Stop()
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
s.Start()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/wang-jinsheng/best_rpc.git
git@gitee.com:wang-jinsheng/best_rpc.git
wang-jinsheng
best_rpc
best_rpc
v1.0.7

搜索帮助