mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-23 05:08:13 -05:00
27 lines
476 B
Go
27 lines
476 B
Go
package rpc
|
|
|
|
import (
|
|
"net"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
pb "github.com/p14yground/nezha/proto"
|
|
rpcService "github.com/p14yground/nezha/service/rpc"
|
|
)
|
|
|
|
// ServeRPC ...
|
|
func ServeRPC() {
|
|
server := grpc.NewServer()
|
|
pb.RegisterNezhaServiceServer(server, &rpcService.NezhaHandler{
|
|
Auth: &rpcService.AuthHandler{
|
|
ClientID: "naiba",
|
|
ClientSecret: "123456",
|
|
},
|
|
})
|
|
listen, err := net.Listen("tcp", ":5555")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
server.Serve(listen)
|
|
}
|