syntax = "proto3";
option go_package = "helloword";
package helloworld;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
安装工生成工具
go get github.com/rpcxio/protoc-gen-gogorpcx/protoc-gen-gofast
生成
protoc --gofast_out=plugins=rpcx:. myproto.proto
启动服务和客户端
go run hello/main.go
go run rpc_server/server1/server.go
go run rpc_server/server2/server.go
go run rpc_server/server3/server.go
访问
http://localhost:8000/rpc-hello?name=word
http://localhost:8000/rpc?a=17&b=123
安装工生成工具
生成
启动服务和客户端
访问