{"id":13670337,"url":"https://github.com/osgochina/dmicro","last_synced_at":"2026-01-17T14:35:26.401Z","repository":{"id":41396278,"uuid":"393234664","full_name":"osgochina/dmicro","owner":"osgochina","description":"dmicro是一个高效、可扩展且简单易用的微服务框架。包含drpc,dserver等组件。","archived":false,"fork":false,"pushed_at":"2025-11-21T09:02:57.000Z","size":2858,"stargazers_count":238,"open_issues_count":2,"forks_count":31,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-11-21T11:07:06.568Z","etag":null,"topics":["go","microservice","rpc"],"latest_commit_sha":null,"homepage":"https://dmicro.vprix.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osgochina.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,"roadmap":null,"authors":null}},"created_at":"2021-08-06T03:20:10.000Z","updated_at":"2025-11-21T09:03:01.000Z","dependencies_parsed_at":"2023-12-07T04:25:09.404Z","dependency_job_id":"a3b50932-60ab-4bf1-b992-678468087fc8","html_url":"https://github.com/osgochina/dmicro","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/osgochina/dmicro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fdmicro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fdmicro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fdmicro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fdmicro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osgochina","download_url":"https://codeload.github.com/osgochina/dmicro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fdmicro/sbom","scorecard":{"id":713455,"data":{"date":"2025-08-11","repo":{"name":"github.com/osgochina/dmicro","commit":"4b11192ba15326d814c138a00a1a5c3f985d2a30"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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: Apache License 2.0: 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":"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":-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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2459 / GHSA-ppxx-5m9h-6vxf","Warn: Project is vulnerable to: GO-2024-2682 / GHSA-c33x-xqrf-c478","Warn: Project is vulnerable to: GO-2024-3302 / GHSA-px8v-pp82-rcvr","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GO-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37"],"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-22T08:47:59.751Z","repository_id":41396278,"created_at":"2025-08-22T08:47:59.751Z","updated_at":"2025-08-22T08:47:59.751Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"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","microservice","rpc"],"created_at":"2024-08-02T09:00:39.320Z","updated_at":"2026-01-17T14:35:26.384Z","avatar_url":"https://github.com/osgochina.png","language":"Go","funding_links":[],"categories":["Libraries and Plugins"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./docs/logo.svg\" width=\"180\" height=\"140\" alt=\"dmicro logo\"/\u003e\n\u003ch4\u003e让你的Golang开发无比简单\u003c/h4\u003e\n\n[![GitHub release](https://img.shields.io/github/v/release/osgochina/dmicro.svg?style=flat-square)](https://github.com/osgochina/dmicro/releases)\n[![report card](https://goreportcard.com/badge/github.com/osgochina/dmicro?style=flat-square)](http://goreportcard.com/report/osgochina/dmicro)\n[![github issues](https://img.shields.io/github/issues/osgochina/dmicro.svg?style=flat-square)](https://github.com/osgochina/dmicro/issues?q=is%3Aopen+is%3Aissue)\n[![github closed issues](https://img.shields.io/github/issues-closed-raw/osgochina/dmicro.svg?style=flat-square)](https://github.com/osgochina/dmicro/issues?q=is%3Aissue+is%3Aclosed)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/osgochina/dmicro)\n[![view examples](https://img.shields.io/badge/learn%20by-examples-00BCD4.svg?style=flat-square)](https://github.com/osgochina/dmicro/tree/main/examples)\n[![OSCS Status](https://www.oscs1024.com/platform/badge/osgochina/dmicro.git.svg?size=small)](https://www.murphysec.com/dr/JycJlZcX36soO749SO)\n\n\u003c/div\u003e\n\n## 概述\n\n\n`DMicro`是一个高效、可扩展且简单易用的微服务框架。包含`DRPC`,`DServer`等多个组件。\n\n其中`DRPC`组件是rpc框架，使用`endpoint`作为统一对象，为`RPC Server`，`RPC Clinet`提供统一的API封装。\n\n`DRPC`组件特性：\n* 易于理解，科学合理的多层抽象。\n  * `endpoint`,`session`,`handle`,`message`,`protoco`,`codec`,`transfer filter`,`plugin`.\n* 支持常见的消息通讯协议`json`，`prototbuf`,`http`,`jsronrpc`,良好的抽象层让自定义消息协议变得简单快捷。\n* 支持多种网络协议`tcp`,`unix`,`kcp`,`quic`,`websocket`等。。。\n* 全生命周期的插件埋点(多达27个埋点),让插件系统能实现的功能丰富多彩。\n  * 内置 `auth`,`heartbeat`，`ignorecase`,`proxy`,`securebody`等插件\n* 依托丰富的插件埋点，抽象出易于使用的`Event`事件系统，让你的开发如虎添翼。\n* 高性能的网络传输层，让性能不再是瓶颈。\n* 客户端自动重拨。\n* 配合`DServer`组件，实现优雅的平滑重启，让你的服务时刻在线。\n* 配合`Registry`组件，实现服务注册。\n  * `Registry`组件抽象出合理的接口，方便接入多个服务注册中心，目前已实现`etcd`,`mdns`。\n* 配合`Selector`组件实现`服务发现`功能。\n* 使用`metrics`组件实现指标统计功能。\n\n`DServer`应用管理组件帮助大家封装好了应用的全生命周期管理。\n\n`DServer`组件特性：\n\n* 采用`server`,`service`,`sandbox`三层结构。 让业务专注于`sandbox`层，支持单进程，多进程模式。做到开发debug单进程，运行单/多进程可选。\n* 完善合理的启动命令封装，支持`start`,`stop`，`reload`,`ctrl`等命令。\n* 不但支持`drpc`组件，还支持`ghttp`等实现平滑重启接口的其他组件(如果不需要平滑重启，所有服务组件都支持)\n* 好用的命令行管理功能，让你能实时的管理正在运行的应用。\n* 完善的进程管理组件`supervisor`,支持对进程的全生命周期管理。\n\n[详细文档]( https://osgochina.gitee.io/dmicro)\n\n\n## 安装\n\n```shell\ngo get -u -v github.com/osgochina/dmicro\n```\n\n推荐使用 `go.mod`:\n```\nrequire github.com/osgochina/dmicro latest\n```\n\n* import\n\n```go\nimport \"github.com/osgochina/dmicro\"\n```\n\n国内镜像: https://gitee.com/osgochina/dmicro\n\n## 限制\n```shell\ngolang版本 \u003e= 1.16\n```\n\n## 使用`DServer`创建`rpc`服务\n\n如何快速的通过简单的代码创建一个真正的rpc服务。\n以下就是示例代码：\n```go\n// rbc_server.go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/osgochina/dmicro/drpc\"\n\t\"github.com/osgochina/dmicro/dserver\"\n\t\"github.com/osgochina/dmicro/logger\"\n)\n// DRpcSandBox  默认的服务\ntype DRpcSandBox struct {\n\tdserver.BaseSandbox\n\tendpoint drpc.Endpoint\n}\n\nfunc (that *DRpcSandBox) Name() string {\n\treturn \"DRpcSandBox\"\n}\n\nfunc (that *DRpcSandBox) Setup() error {\n\tfmt.Println(\"DRpcSandBox Setup\")\n\tcfg := that.Config.EndpointConfig(that.Name())\n\tcfg.ListenPort = 9091\n\tcfg.PrintDetail = true\n\tthat.endpoint = drpc.NewEndpoint(cfg)\n\tthat.endpoint.RouteCall(new(Math))\n\treturn that.endpoint.ListenAndServe()\n}\n\nfunc (that *DRpcSandBox) Shutdown() error {\n\tfmt.Println(\"DRpcSandBox Shutdown\")\n\treturn that.endpoint.Close()\n}\n\n\n// Math rpc请求的最终处理器，必须集成drpc.CallCtx\ntype Math struct {\n\tdrpc.CallCtx\n}\n\nfunc (m *Math) Add(arg *[]int) (int, *drpc.Status) {\n\t// test meta\n\tlogger.Infof(\"author: %s\", m.PeekMeta(\"author\"))\n\t// add\n\tvar r int\n\tfor _, a := range *arg {\n\t\tr += a\n\t}\n\t// response\n\treturn r, nil\n}\n\nfunc main() {\n\tdserver.Authors = \"osgochina@gmail.com\"\n\tdserver.SetName(\"DMicro_drpc\")\n\tdserver.Setup(func(svr *dserver.DServer) {\n\t\terr := svr.AddSandBox(new(DRpcSandBox))\n\t\tif err != nil {\n\t\t\tlogger.Fatal(err)\n\t\t}\n\t})\n}\n\n```\n\n- 编译\n```shell\n$ go build rbc_server.go\n```\n\n- 运行\n\n```shell\n$ ./rbc_server start\n```\n\n\n## 创建普通`rpc`客户端\n\n服务已经建立完毕，如何通过client链接它呢？\n\n```go\npackage main\n\nimport (\n\t\"time\"\n\t\"github.com/osgochina/dmicro/drpc\"\n\t\"github.com/osgochina/dmicro/drpc/message\"\n\t\"github.com/osgochina/dmicro/logger\"\n)\n\nfunc main() {\n\tcli := drpc.NewEndpoint(drpc.EndpointConfig{PrintDetail: true, RedialTimes: -1, RedialInterval: time.Second})\n\tdefer cli.Close()\n\n\tsess, stat := cli.Dial(\"127.0.0.1:9091\")\n\tif !stat.OK() {\n\t\tlogger.Fatalf(\"%v\", stat)\n\t}\n\tvar result int\n\tstat = sess.Call(\"/math/add\",\n\t\t[]int{1, 2, 3, 4, 5},\n\t\t\u0026result,\n\t\tmessage.WithSetMeta(\"author\", \"liuzhiming\"),\n\t).Status()\n\tif !stat.OK() {\n\t\tlogger.Fatalf(\"%v\", stat)\n\t}\n\tlogger.Printf(\"result: %d\", result)\n}\n```\n通过以上的代码事例，大家基本可以了解`drpc`框架是怎么使用。\n\n## `ctrl`命令\n\n使用`ctrl`命令管理正在运行的`server`\n\n- 打开新的命令行窗口运行`ctrl`命令\n\n```shell\n$ ./rbc_server.exe ctl\n\n  ____    ____\n |  _ \\  / ___|    ___   _ __  __   __   ___   _ __ \n | | | | \\___ \\   / _ \\ | '__| \\ \\ / /  / _ \\ | '__|\n | |_| |  ___) | |  __/ | |     \\ V /  |  __/ | |   \n |____/  |____/   \\___| |_|      \\_/    \\___| |_|  \nVersion:         No Version Info\nGo Version:      No Version Info\nDMicro Version:  v1.0.0\nGF Version:      v1.16.9\nGit Commit:      No Commit Info\nBuild Time:      No Time Info\nAuthors:         osgochina@gmail.com\nInstall Path:    D:\\code\\GolandProjects\\dmicro\\examples\\simple_dserver\\rbc_server.exe\nDMicro_drpc »\n\n```\n- 运行`help`命令，获取命令说明\n\n```shell\nDMicro_drpc » help\n\n好用的服务管理工具\n\nCommands:\n=========\n  clear             clear the screen\n  debug             debug开关\n  exit              exit the shell\n  help              use 'help [command]' for command help\n  info, status, ps  查看当前服务状态\n  log               打印出服务的运行日志\n  reload            平滑重启服务\n  start             启动服务\n  stop              停止服务\n  version, v        打印当前程序的版本信息\n\nDMicro_drpc »\n```\n\n## TODO \n- [x] `Registry` 服务注册\n- [x] `Selector` 服务发现\n- [x] `Eventbus` 事件总线\n- [x] `Supervisor` 进程管理\n- [x] `Metrics` 指标统计\n- [ ] `OpenAPI` 文档自动生成\n- [ ] `Code gen` 代码生成\n- [ ] `Tracing` 链路追踪\n- [ ] `Broker` 限流熔断\n\n\n## 感谢\n\n`DMicro`该项目的诞生离不开`erpc`和`GoFrame`两个优秀的项目。\n\n其中`drpc`组件参考`erpc`项目的架构思想，依赖的基础库是`GoFrame`。\n\n* [erpc](https://github.com/henrylee2cn/erpc)\n* [GoFrame](https://github.com/gogf/gf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosgochina%2Fdmicro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosgochina%2Fdmicro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosgochina%2Fdmicro/lists"}