{"id":46566844,"url":"https://github.com/go-pkgz/jrpc","last_synced_at":"2026-03-07T07:30:56.368Z","repository":{"id":45894367,"uuid":"199693713","full_name":"go-pkgz/jrpc","owner":"go-pkgz","description":"RPC with json","archived":false,"fork":false,"pushed_at":"2025-12-03T21:42:29.000Z","size":55,"stargazers_count":17,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-06T18:42:19.914Z","etag":null,"topics":["go","golang-library","json","plugin-system","rpc"],"latest_commit_sha":null,"homepage":null,"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/go-pkgz.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-30T17:00:35.000Z","updated_at":"2025-12-03T17:46:01.000Z","dependencies_parsed_at":"2025-01-18T03:16:58.651Z","dependency_job_id":null,"html_url":"https://github.com/go-pkgz/jrpc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/go-pkgz/jrpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-pkgz%2Fjrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-pkgz%2Fjrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-pkgz%2Fjrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-pkgz%2Fjrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-pkgz","download_url":"https://codeload.github.com/go-pkgz/jrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-pkgz%2Fjrpc/sbom","scorecard":{"id":432332,"data":{"date":"2025-08-11","repo":{"name":"github.com/go-pkgz/jrpc","commit":"1b265f78d15566564745490d8f5485d8da38e9f2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"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":"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":"Code-Review","score":3,"reason":"Found 9/27 approved changesets -- score normalized to 3","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/ci.yml: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":"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":"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/go-pkgz/jrpc/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/go-pkgz/jrpc/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/go-pkgz/jrpc/ci.yml/master?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/ci.yml:35","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   2 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":"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":"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":"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":"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":"SAST","score":1,"reason":"SAST tool is not run on all commits -- score normalized to 1","details":["Warn: 2 commits out of 13 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"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3770 / GHSA-vrw8-fxc6-2r93","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T03:40:22.948Z","repository_id":45894367,"created_at":"2025-08-19T03:40:22.948Z","updated_at":"2025-08-19T03:40:22.948Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"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":["go","golang-library","json","plugin-system","rpc"],"created_at":"2026-03-07T07:30:54.968Z","updated_at":"2026-03-07T07:30:56.357Z","avatar_url":"https://github.com/go-pkgz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jrpc - rpc with json [![Build](https://github.com/go-pkgz/jrpc/actions/workflows/ci.yml/badge.svg)](https://github.com/go-pkgz/jrpc/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/go-pkgz/jrpc)](https://goreportcard.com/report/github.com/go-pkgz/jrpc) [![Coverage Status](https://coveralls.io/repos/github/go-pkgz/jrpc/badge.svg?branch=master)](https://coveralls.io/github/go-pkgz/jrpc?branch=master) [![godoc](https://godoc.org/github.com/go-pkgz/jrpc?status.svg)](https://godoc.org/github.com/go-pkgz/jrpc)\n\njrpc library provides client and server for RPC-like communication over HTTP with json encoded messages.\nThe protocol is a somewhat simplified version of json-rpc with a single POST call sending `Request` json \n(method name and the list of parameters) moreover, receiving json `Response` with result data and an error string.\n\n## Usage\n\n### Plugin (server)\n\n```go\n// Plugin wraps jrpc.Server and adds synced map to store data\ntype Plugin struct {\n\t*jrpc.Server\n}\n\n// create plugin (jrpc server) with NewServer where required param is a base url for rpc calls\nplugin := NewServer(\"/command\")\n\n// then add you function to map \nplugin.Add(\"mycommand\", func(id uint64, params json.RawMessage) Response {\n    return jrpc.EncodeResponse(id, \"hello, it works\", nil)\n})\n\n// and run server with port number value\nplugin.Run(9090)\n```\n\nThe constructor `NewServer` accept two parameters:\n* `API` - a base url for rpc calls\n* `Options` - optional parameters such is timeouts, logger, limits, middlewares and etc.\n  * `Auth` - set credentials basic auth to server, accepts `username` and `password`\n  * `WithTimeout` - sets global timeouts for server requests, such as read, write and idle. Call accept `Timeouts` struct.\n  * `WithLimits` - define limit for server call, accepts limit value in `float64` type\n  * `WithThrottler` - sets throttler middleware with specify limit value\n  * `WithtSignature` - sets server signature, accept appName, author and version. Disable by default. \n  * `WithLogger` - define custom logger (e.g. [lgr](https://github.com/go-pkgz/lgr))\n  * `WithMiddlewares` - sets custom middlewares list to server, accepts list of handler with idiomatic type `func(http.Handler) http.Handler`\n\nExample with options:\n```go\nplugin := NewServer(\"/command\",\n\t    Auth(\"user\", \"password\"),\n\t\tWithTimeout(Timeouts{ReadHeaderTimeout: 5 * time.Second, WriteTimeout: 5 * time.Second, IdleTimeout: 10 * time.Second}),\n\t\tWithThrottler(120),\n\t\tWithLimits(100),\n        WithtSignature(\"the best plugin ever\", \"author\", \"1.0.0\"),\n\t\tWithMiddlewares(middleware.Heartbeat('/ping'), middleware.Profiler, middleware.StripSlashes),\n)\n``` \n\n### Application (client)\n\n```go\n// Client makes jrpc.Client and invoke remote call\nrpcClient := jrpc.Client{\n    API:        \"http://127.0.0.1:8080/command\",\n    Client:     http.Client{},\n    AuthUser:   \"user\",\n    AuthPasswd: \"password\",\n}\n\nresp, err := rpcClient.Call(\"mycommand\")\nvar message string\nif err = json.Unmarshal(*resp.Result, \u0026message); err != nil {\n    panic(err)\n}\n```\n\n*for functional examples for both plugin and application see [_example](https://github.com/go-pkgz/jrpc/tree/master/_example)*\n \n## Technical details\n \n * `jrpc.Server` runs on user-defined port as a regular http server\n * Server accepts a single POST request on user-defined url with [Request](https://github.com/go-pkgz/jrpc/blob/master/jrpc.go#L12) sent as json payload\n \u003cdetails\u003e\u003csummary\u003erequest details and an example:\u003c/summary\u003e\n \n     ```go\n     type Request struct {\n     \tMethod string      `json:\"method\"`\n     \tParams interface{} `json:\"params,omitempty\"`\n     \tID     uint64      `json:\"id\"`\n     }\n     ```\n     example: \n     \n     ```json\n       {\n        \"method\":\"test\",\n        \"params\":[123,\"abc\"],\n        \"id\":1\n        }\n     ```\n \u003c/details\u003e\n \n* Params can be a struct, primitive type or slice of values, even with different types.\n* Server defines `ServerFn` handler function to react on a POST request. The handler provided by the user.\n* Communication between the server and the caller can be protected with basic auth.\n* [Client](https://github.com/go-pkgz/jrpc/blob/master/client.go) provides a single method `Call` and return `Response`\n\n \u003cdetails\u003e\u003csummary\u003eresponse details:\u003c/summary\u003e\n \n   ```go\n    // Response encloses result and error received from remote server\n    type Response struct {\n    \tResult *json.RawMessage `json:\"result,omitempty\"`\n    \tError  string           `json:\"error,omitempty\"`\n    \tID     uint64           `json:\"id\"`\n    }\n   ```\n \u003c/details\u003e\n \n* User should encode and decode json payloads on the application level, see provided [examples](https://github.com/go-pkgz/jrpc/tree/master/_example)\n* `jrpc.Server` doesn't support https internally (yet). If used on exposed or non-private networks, should be proxied with something providing https termination (nginx and others). \n\n## Status\n\nThe code was extracted from [remark42](https://github.com/umputun/remark) and still under development. Until v1.x released the\n API \u0026 protocol may change.\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-pkgz%2Fjrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-pkgz%2Fjrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-pkgz%2Fjrpc/lists"}