{"id":21095204,"url":"https://github.com/dan-and-dna/arpc","last_synced_at":"2026-05-15T21:07:08.234Z","repository":{"id":109620566,"uuid":"525479739","full_name":"DAN-AND-DNA/arpc","owner":"DAN-AND-DNA","description":"json rpc","archived":false,"fork":false,"pushed_at":"2022-08-16T17:29:40.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T21:28:01.323Z","etag":null,"topics":["golang","json","jsonrpc","rpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DAN-AND-DNA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-16T17:29:37.000Z","updated_at":"2023-07-27T05:49:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"f9ca7002-56d8-4b55-a7ca-9d0c2b6c0955","html_url":"https://github.com/DAN-AND-DNA/arpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DAN-AND-DNA/arpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Farpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Farpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Farpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Farpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAN-AND-DNA","download_url":"https://codeload.github.com/DAN-AND-DNA/arpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Farpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33080439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","json","jsonrpc","rpc"],"created_at":"2024-11-19T22:24:38.402Z","updated_at":"2026-05-15T21:07:08.218Z","avatar_url":"https://github.com/DAN-AND-DNA.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# arpc\n\n修改过的标准库rpc，暴露连接的信息，为了对接kcp和go-kit实现udp和接入微服务组件，也为了能获得连接的消息\n\n## 基准\njson为本包修改过的rpc，gob为官方的性能，但是数据量比protobuf还是太大了\n\n```\n=== RUN   Test_gob_rpc_call\n--- PASS: Test_gob_rpc_call (0.00s)\n=== RUN   Test_json_rpc_call\n--- PASS: Test_json_rpc_call (0.00s)\ngoos: linux\ngoarch: amd64\npkg: template-project/benchmark\ncpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz\nBenchmark_server_handle_json_rpc_call\nBenchmark_server_handle_json_rpc_call-6   \t 1291899\t       922.6 ns/op\t    1960 B/op\t      25 allocs/op\nBenchmark_server_handle_gob_rpc_call\nBenchmark_server_handle_gob_rpc_call-6    \t  195685\t      5492 ns/op\t   16828 B/op\t     220 allocs/op\nPASS\n```\n\n## 测试\n\n```\n=== RUN   Test_client_json_rpc_call_easy\n--- PASS: Test_client_json_rpc_call_easy (0.00s)\n=== RUN   Test_client_json_rpc_call_map\n--- PASS: Test_client_json_rpc_call_map (0.00s)\n=== RUN   Test_client_json_rpc_call_bytes\n--- PASS: Test_client_json_rpc_call_bytes (0.00s)\nPASS\n```\n\n\n## example\n```golang\nfunc Benchmark_server_handle_json_rpc_call(b *testing.B) {\n\tb.ReportAllocs()\n\n\tb.RunParallel(func(pb *testing.PB) {\n\t\tdump_req := []byte(`{\"method\": \"Dan.Ping\", \"id\": \"7\", \"params\":[\"ping\"]}`)\n\n\t\tconn := new(pkg_test_tool.Test_conn)\n\n\t\tserver := pkg_rpc.New_server()\n\t\td := \u0026Dan{}\n\t\tif err := server.Register(d); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor pb.Next() {\n\t\t\tconn.Input_req(dump_req)\n\t\t\tserver.Test_json(conn)\n\t\t\tconn.Reset()\n\t\t}\n\t})\n}\n\nfunc Benchmark_server_handle_gob_rpc_call(b *testing.B) {\n\tb.ReportAllocs()\n\n\tb.RunParallel(func(pb *testing.PB) {\n\t\tr := \u0026arpc.Request{}\n\t\tr.Seq = 37\n\t\tr.ServiceMethod = \"Dan.Ping\"\n\n\t\tvar enc_buf bytes.Buffer\n\t\tenc := gob.NewEncoder(\u0026enc_buf)\n\n\t\tvar args string = \"ping\"\n\t\tenc.Encode(r)\n\t\tenc.Encode(\u0026args)\n\n\t\tdump_req := enc_buf.Bytes()\n\n\t\tconn := new(pkg_test_tool.Test_conn)\n\t\tserver := pkg_rpc.New_server()\n\t\td := \u0026Dan{}\n\t\tif err := server.Register(d); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor pb.Next() {\n\t\t\tconn.Input_req(dump_req)\n\t\t\tserver.Test(conn)\n\t\t\tconn.Reset()\n\t\t}\n\t})\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan-and-dna%2Farpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdan-and-dna%2Farpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan-and-dna%2Farpc/lists"}