{"id":25666526,"url":"https://github.com/visiperf/visigrpc","last_synced_at":"2026-05-19T07:32:54.934Z","repository":{"id":54849162,"uuid":"235553743","full_name":"visiperf/visigrpc","owner":"visiperf","description":"Golang gRPC helpers, middlewares ...","archived":false,"fork":false,"pushed_at":"2021-10-21T09:47:45.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-13T11:02:49.435Z","etag":null,"topics":["grpc","grpc-error","grpc-helpers","grpc-middleware","package"],"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/visiperf.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}},"created_at":"2020-01-22T10:53:52.000Z","updated_at":"2021-10-21T09:47:15.000Z","dependencies_parsed_at":"2022-08-14T04:40:45.825Z","dependency_job_id":null,"html_url":"https://github.com/visiperf/visigrpc","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/visiperf/visigrpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visiperf%2Fvisigrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visiperf%2Fvisigrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visiperf%2Fvisigrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visiperf%2Fvisigrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visiperf","download_url":"https://codeload.github.com/visiperf/visigrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visiperf%2Fvisigrpc/sbom","scorecard":{"id":923687,"data":{"date":"2025-08-04","repo":{"name":"github.com/visiperf/visigrpc","commit":"2b9b54f8fd4d5af5e0acf3c001fd055acd69eb59"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3.3,"checks":[{"name":"Code-Review","score":6,"reason":"Found 5/8 approved changesets -- score normalized to 6","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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-25T08:14:42.974Z","repository_id":54849162,"created_at":"2025-08-25T08:14:42.974Z","updated_at":"2025-08-25T08:14:42.974Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278555446,"owners_count":26006079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"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":["grpc","grpc-error","grpc-helpers","grpc-middleware","package"],"created_at":"2025-02-24T08:30:42.408Z","updated_at":"2025-10-06T03:33:31.312Z","avatar_url":"https://github.com/visiperf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gRPC helpers, middlewares ... for Golang\n\nPackage `visigrpc` provide some functions to help you making a gRPC server. Errors logged on [Sentry](https://sentry.io), Panic interceptor, HTTP status to gRPC code, ... Everything is made to assist you :)\n\nTable of contents\n=================\n\n  * [Install](#install)\n  * [Usage](#usage)\n      * [Status](#status)\n        * [Error](#error)\n        * [New](#new)\n        * [From error](#from-error)\n        * [gRPC code from HTTP status](#grpc-code-from-http-status)\n    * [Panic interceptor](#panic-interceptor)\n  * [References](#references)\n\n## Install\n\nUse `go get` to install this package.\n\n    go get github.com/visiperf/visigrpc\n\n\n## Usage\n\n### Status\n\n#### Error\n\nThe `Error(code codes.Code, msg string) error` function is used to return a gRPC error and log it into [Sentry](https://sentry.io).\n\n```go\ntype server struct { }\n\nfunc main() {\n  // init Sentry config\n  if err := sentry.Init(sentry.ClientOptions{\n    Dsn:         SENTRY_DSN,\n    Environment: SENTRY_ENV,\n    Transport:   sentry.NewHTTPSyncTransport(),\n  }); err != nil {\n    ...\n  }\n  \n  // gRPC server\n  lis, err := net.Listen(\"tcp\", \":9090\")\n  if err != nil {\n    ...\n  }\n  \n  s := grpc.NewServer()\n  \n  RegisterServiceServer(s, \u0026server{})\n  \n  if err := s.Serve(lis); err != nil {\n    ...\n  }\n}\n\nfunc (s *server) Get(ctx context.Context, in *GetRequest) (*GetResponse, error) {\n  return nil, status.Error(codes.Unimplemented, \"implement me\")\n}\n```\n\n##### IMPORTANT : Only `Unknown`, `Internal` and `DataLoss` errors will be reported in Sentry !\n\n#### New\n\nThe `New(code codes.Code, msg string) *spb.Status` function has same process as `Error(...) error` function, but returns a `*spb.Status` instance instead of `error`.\n\n```go\ntype server struct { }\n\nfunc main() {\n  // init Sentry config\n  if err := sentry.Init(sentry.ClientOptions{\n    Dsn:         SENTRY_DSN,\n    Environment: SENTRY_ENV,\n    Transport:   sentry.NewHTTPSyncTransport(),\n  }); err != nil {\n    ...\n  }\n  \n  // gRPC server\n  lis, err := net.Listen(\"tcp\", \":9090\")\n  if err != nil {\n    ...\n  }\n  \n  s := grpc.NewServer()\n  \n  RegisterServiceServer(s, \u0026server{})\n  \n  if err := s.Serve(lis); err != nil {\n    ...\n  }\n}\n\nfunc (s *server) Get(ctx context.Context, in *GetRequest) (*GetResponse, error) {\n  st := status.New(codes.Internal, \"Oups, an error !\")\n  // st.Code -\u003e codes.Internal\n  // st.Message -\u003e \"Oups, an error !\"\n  ...\n  \n  return nil, status.Error(codes.Unimplemented, \"implement me\")\n}\n```\n\n\n\n#### From Error\n\nIf you receive a gRPC error (made with status.Error(...)), you can decode it with `FromError(err error) *spb.Status` to retrieve the gRPC code and message.\n\n```go\ntype server struct { }\n\nfunc main() {\n  // init Sentry config\n  if err := sentry.Init(sentry.ClientOptions{\n    Dsn:         SENTRY_DSN,\n    Environment: SENTRY_ENV,\n    Transport:   sentry.NewHTTPSyncTransport(),\n  }); err != nil {\n    ...\n  }\n  \n  // gRPC server\n  lis, err := net.Listen(\"tcp\", \":9090\")\n  if err != nil {\n    ...\n  }\n  \n  s := grpc.NewServer()\n  \n  RegisterServiceServer(s, \u0026server{})\n  \n  if err := s.Serve(lis); err != nil {\n    ...\n  }\n}\n\nfunc (s *server) Get(ctx context.Context, in *GetRequest) (*GetResponse, error) {\n  return nil, status.Error(codes.Unimplemented, \"implement me\")\n}\n\nfunc (s *server) Create(ctx context.Context, in *CreateRequest) (*CreateResponse, error) {\n  resp, err := s.Get(ctx, \u0026GetRequest{}) // just for example, never directly call self functions with `s *server` !\n  if err != nil {\n    st := status.FromError(err)\n    // st.Code -\u003e codes.Unimplemented\n    // st.Message -\u003e \"implement me\"\n    ...\n  }\n  \n  return nil, status.Error(codes.Unimplemented, \"implement me\")\n}\n```\n\n#### gRPC code from HTTP status\n\nIf you make an HTTP request, you can use the `GrpcCodeFromHttpStatus(status int) codes.Code` func to convert HTTP status code in response to gRPC code.\n\n```go\ncode := status.GrpcCodeFromHttpStatus(http.StatusForbidden) // http status -\u003e 403 (Forbidden)\n\n// code -\u003e 7 (codes.PermissionDenied)\n```\n\n### Panic interceptor\n\nVisigrpc also provide a `RecoveryHandler` to capture and log panics for `Unary` and `Stream` functions.\n\n```go\ntype server struct { }\n\nfunc main() {\n  // init Sentry config\n  if err := sentry.Init(sentry.ClientOptions{\n    Dsn:         SENTRY_DSN,\n    Environment: SENTRY_ENV,\n    Transport:   sentry.NewHTTPSyncTransport(),\n  }); err != nil {\n    ...\n  }\n  \n  // gRPC server\n  lis, err := net.Listen(\"tcp\", \":9090\")\n  if err != nil {\n    ...\n  }\n  \n  var opts = []grpc_recovery.Option{\n    grpc_recovery.WithRecoveryHandler(visigrpc.RecoveryHandler),\n  }\n\n  s := grpc.NewServer(\n    grpc_middleware.WithUnaryServerChain(\n       grpc_recovery.UnaryServerInterceptor(opts...),\n    ),\n    grpc_middleware.WithStreamServerChain(\n       grpc_recovery.StreamServerInterceptor(opts...),\n    ),\n  )\n  \n  RegisterServiceServer(s, \u0026server{})\n  \n  if err := s.Serve(lis); err != nil {\n    ...\n  }\n}\n\nfunc (s *server) Get(ctx context.Context, in *GetRequest) (*GetResponse, error) {\n  panic(\"implement me\") // will return codes.Unknown with message \"implement me\" and log error on Sentry\n}\n```\n\n\n\n## References\n\n* Sentry : [github.com/getsentry/sentry-go](https://github.com/getsentry/sentry-go)\n* Go gRPC Middleware : [github.com/grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisiperf%2Fvisigrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisiperf%2Fvisigrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisiperf%2Fvisigrpc/lists"}