{"id":20695984,"url":"https://github.com/weiwenchen2022/protorpc","last_synced_at":"2026-05-30T22:31:46.586Z","repository":{"id":189442617,"uuid":"669726927","full_name":"weiwenchen2022/protorpc","owner":"weiwenchen2022","description":"Protocol-buffers RPC for Go net/rpc","archived":false,"fork":false,"pushed_at":"2023-08-20T04:44:03.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-13T11:42:43.391Z","etag":null,"topics":["go","library","protocol-buffers","rpc"],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/weiwenchen2022/protorpc","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weiwenchen2022.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-23T08:23:08.000Z","updated_at":"2023-07-23T08:28:34.000Z","dependencies_parsed_at":"2023-08-20T05:39:24.069Z","dependency_job_id":"b20ec554-9df3-4161-b133-aff16a2ed556","html_url":"https://github.com/weiwenchen2022/protorpc","commit_stats":null,"previous_names":["weiwenchen2022/protorpc"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/weiwenchen2022/protorpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiwenchen2022%2Fprotorpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiwenchen2022%2Fprotorpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiwenchen2022%2Fprotorpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiwenchen2022%2Fprotorpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weiwenchen2022","download_url":"https://codeload.github.com/weiwenchen2022/protorpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiwenchen2022%2Fprotorpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33712579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","library","protocol-buffers","rpc"],"created_at":"2024-11-17T00:12:09.779Z","updated_at":"2026-05-30T22:31:46.569Z","avatar_url":"https://github.com/weiwenchen2022.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protorpc\n\nPackage protorpc implements a Protobuf-RPC ClientCodec and ServerCodec for the rpc package.\n\n# Install\n\nInstall Go plugins for the protocol compiler:\n\n`go install google.golang.org/protobuf/cmd/protoc-gen-go@latest`\n\n`go install github.com/weiwenchen2022/protorpc/cmd/protoc-gen-go-netrpc@latest`\n\nInstall `protorpc` package:\n\n`go get github.com/weiwenchen2022/protorpc`\n\n# Examples\n\nFirst, Open [helloworld/helloworld.proto](examples/helloworld/helloworld.proto):\n\n```Proto\nsyntax = \"proto3\";\n\noption go_package = \"github.com/weiwenchen2022/protorpc/examples/helloworld/helloworld\";\n\npackage helloworld;\n\n// The greeting service definition.\nservice Greeter {\n  // Sends a greeting\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\n}\n\n// The request message containing the user's name.\nmessage HelloRequest {\n  string name = 1;\n}\n\n// The response message containing the greetings\nmessage HelloReply {\n  string message = 1;\n}\n```\n\nSecond, compile the helloworld.proto file, run the following command (we can use `go generate` to invoke this command, see [helloworld.go](examples/helloworld/helloworld/helloworld.go)): \n\n\tprotoc --go_out=. --go_opt=paths=source_relative \\\n    \t--go-netrpc_out=. --go-netrpc_opt=paths=source_relative \\\n    \thelloworld/helloworld.proto\n\nThis will regenerate the helloworld.pb.go and helloworld_netrpc.pb.go files.\n\nNow, we can use the generated code like this:\n\n```Go\npackage main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"net/rpc\"\n\n\t\"github.com/weiwenchen2022/protorpc\"\n\tpb \"github.com/weiwenchen2022/protorpc/examples/helloworld/helloworld\"\n)\n\n// server is used to implement helloworld.GreeterServer.\ntype server struct {\n\tpb.UnimplementedGreeterServer\n}\n\n// SayHello implements helloworld.GreeterServer\nfunc (s *server) SayHello(args *pb.HelloRequest, reply *pb.HelloReply) error {\n\tlog.Printf(\"Received: %v\", args.GetName())\n\t*reply = pb.HelloReply{Message: \"Hello \" + args.GetName()}\n\treturn nil\n}\n\nfunc main() {\n\tl, e := net.Listen(\"tcp\", \":1234\")\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\n\ts := rpc.NewServer()\n\tpb.RegisterGreeterServer(s, new(server))\n\n\tlog.Printf(\"server listening at %v\", l.Addr())\n\tgo func() {\n\t\tfor {\n\t\t\tconn, err := l.Accept()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"failed to accept: %v\", err)\n\t\t\t}\n\t\t\tgo s.ServeCodec(protorpc.NewServerCodec(conn))\n\t\t}\n\t}()\n\n\tconn, err := protorpc.Dial(\"tcp\", \"localhost:1234\")\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer conn.Close()\n\n\tc := pb.NewGreeterClient(conn)\n\n\t// Synchronous call\n\targs := \u0026pb.HelloRequest{Name: \"world\"}\n\tvar reply pb.HelloReply\n\terr = c.SayHello(args, \u0026reply)\n\tif err != nil {\n\t\tlog.Fatal(\"greet error:\", err)\n\t}\n\tfmt.Printf(\"Greeting: %s\", reply.GetMessage())\n\n\t// Asynchronous call\n\thelloReply := new(pb.HelloReply)\n\thelloCall := c.SayHelloAsync(args, helloReply, nil)\n\thelloCall = \u003c-helloCall.Done // will be equal to helloCall\n\t// check errors, print, etc.\n}\n```\n\n# Reference\n\n`godoc` or [http://godoc.org/github.com/weiwenchen2022/protorpc](http://godoc.org/github.com/weiwenchen2022/protorpc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiwenchen2022%2Fprotorpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweiwenchen2022%2Fprotorpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiwenchen2022%2Fprotorpc/lists"}