{"id":22385233,"url":"https://github.com/acoshift/hrpc","last_synced_at":"2026-04-25T16:33:49.915Z","repository":{"id":18827576,"uuid":"85394620","full_name":"acoshift/hrpc","owner":"acoshift","description":"Convert RPC style function into http.Handler","archived":false,"fork":false,"pushed_at":"2022-10-19T08:53:10.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T16:54:27.131Z","etag":null,"topics":["golang","http-handler","rpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acoshift.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}},"created_at":"2017-03-18T10:56:47.000Z","updated_at":"2022-10-19T13:58:29.000Z","dependencies_parsed_at":"2022-09-18T05:46:21.655Z","dependency_job_id":null,"html_url":"https://github.com/acoshift/hrpc","commit_stats":null,"previous_names":["acoshift/mount"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/acoshift/hrpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoshift%2Fhrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoshift%2Fhrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoshift%2Fhrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoshift%2Fhrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acoshift","download_url":"https://codeload.github.com/acoshift/hrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoshift%2Fhrpc/sbom","scorecard":{"id":163272,"data":{"date":"2025-08-11","repo":{"name":"github.com/acoshift/hrpc","commit":"b11ed8007a4c5e6a7e96a351e5f953a748027297"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/acoshift/hrpc/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/acoshift/hrpc/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/acoshift/hrpc/test.yaml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T14:09:39.327Z","repository_id":18827576,"created_at":"2025-08-16T14:09:39.327Z","updated_at":"2025-08-16T14:09:39.327Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32269459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: 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","http-handler","rpc"],"created_at":"2024-12-05T01:22:19.287Z","updated_at":"2026-04-25T16:33:49.892Z","avatar_url":"https://github.com/acoshift.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hrpc\n\n![Build Status](https://github.com/acoshift/hrpc/actions/workflows/test.yaml/badge.svg?branch=master)\n[![codecov](https://codecov.io/gh/acoshift/hrpc/branch/master/graph/badge.svg?token=3AMuow5vXh)](https://codecov.io/gh/acoshift/hrpc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/acoshift/hrpc)](https://goreportcard.com/report/github.com/acoshift/hrpc)\n[![GoDoc](https://pkg.go.dev/badge/github.com/acoshift/hrpc)](https://pkg.go.dev/github.com/acoshift/hrpc)\n\nConvert RPC style function into http.Handler\n\n## Support input types\n\n- context.Context\n- *http.Request\n- http.ResponseWriter\n- any\n\n## Support output types\n\n- any\n- error\n\n## Usage\n\n```go\nimport \"github.com/acoshift/hrpc/v3\"\n```\n\n### Create new hrpc Manager\n\n```go\nm := hrpc.Manager{\n\tDecoder: func(r *http.Request, dst any) error {\n\t\treturn json.NewDecoder(r.Body).Decode(dst)\n\t},\n\tEncoder: func(w http.ResponseWriter, r *http.Request, res any) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tjson.NewEncoder(w).Encode(res)\n\t},\n\tErrorEncoder: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\tres := \u0026struct {\n\t\t\tError string `json:\"error\"`\n\t\t}{err.Error()}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(res)\n\t},\n\tValidate: true,\n}\n```\n\n### RPC style function\n\n```go\ntype UserRequest struct {\n\tID int `json:\"id\"`\n}\n\nfunc (req *UserRequest) Valid() error {\n\t// Valid will be called when decode, if set validate to true\n\tif req.ID \u003c= 0 {\n\t\treturn fmt.Errorf(\"invalid id\")\n\t}\n\treturn nil\n}\n\ntype UserResponse struct {\n\tID int `json:\"id\"`\n\tUsername string `json:\"username\"`\n}\n\nhttp.Handle(\"/user.get\", m.Handler(func(ctx context.Context, req *UserRequest) (*UserResponse, error) {\n\treturn \u0026UserResponse{ID: 1, Username: \"acoshift\"}, nil\n}))\n\n// or use non-ptr struct\nhttp.Handle(\"/user.get2\", m.Handler(func(ctx context.Context, req UserRequest) (res UserResponse, err error) {\n\tres.ID = 1\n\tres.Username = \"acoshift\"\n\treturn\n}))\n```\n\n### gRPC service client (generated from .proto)\n\n```go\nm.Handler(func(ctx context.Context, in *UserRequest, opts ...grpc.CallOption) (*UserResponse, error) {\n\treturn nil, errors.New(\"not implemented\")\n})\n```\n\n### Mixed types\n\n```go\nm.Handler(func(r *http.Request) error {\n\tbuf := \u0026bytes.Buffer{}\n\t_, err := io.Copy(buf, r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"upload data: %s\\n\", buf.String())\n\treturn nil\n})\n\nm.Handler(func(w http.ResponseWriter, r *http.Request) {})\n\nm.Handler(func(ctx context.Context, r *http.Request, w http.ResponseWriter) {})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facoshift%2Fhrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facoshift%2Fhrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facoshift%2Fhrpc/lists"}