{"id":13412939,"url":"https://github.com/lonng/nano","last_synced_at":"2025-12-14T23:56:22.306Z","repository":{"id":38859527,"uuid":"99078544","full_name":"lonng/nano","owner":"lonng","description":"Lightweight, facility, high performance golang based game server framework","archived":false,"fork":false,"pushed_at":"2025-03-30T04:46:55.000Z","size":1005,"stargazers_count":3141,"open_issues_count":31,"forks_count":461,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-12-14T16:39:48.968Z","etag":null,"topics":["distributed-systems","game","golang","json","lightweight","micro","networking","protobuf","server","tcp-server","websocket-server"],"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/lonng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-02T06:05:14.000Z","updated_at":"2025-12-14T16:37:08.000Z","dependencies_parsed_at":"2023-01-30T00:30:56.008Z","dependency_job_id":"15cbd269-da26-4a9e-93fa-601b2f8d56be","html_url":"https://github.com/lonng/nano","commit_stats":{"total_commits":208,"total_committers":19,"mean_commits":"10.947368421052632","dds":0.3125,"last_synced_commit":"ee534d4e5e8894bf293e3fffee8b0523efd6fb9a"},"previous_names":["lonnng/nano"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lonng/nano","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fnano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fnano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fnano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fnano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lonng","download_url":"https://codeload.github.com/lonng/nano/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fnano/sbom","scorecard":{"id":598265,"data":{"date":"2025-08-11","repo":{"name":"github.com/lonng/nano","commit":"eb696c1a8b02a05604956f957befa8011e0f73e2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"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":"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":"Code-Review","score":5,"reason":"Found 13/24 approved changesets -- score normalized to 5","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lonng/nano/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/lonng/nano/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction 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":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 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":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0288","Warn: Project is vulnerable to: GO-2022-0969 / GHSA-69cg-p879-7622","Warn: Project is vulnerable to: GO-2022-1144 / GHSA-xrjj-mj9h-534m","Warn: Project is vulnerable to: GO-2023-1571 / GHSA-vvpx-j8f3-3w6h","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-2022-0493 / GHSA-p782-xgp4-8hr8","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-20T23:43:40.584Z","repository_id":38859527,"created_at":"2025-08-20T23:43:40.584Z","updated_at":"2025-08-20T23:43:40.584Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27739688,"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-12-14T02:00:11.348Z","response_time":56,"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":["distributed-systems","game","golang","json","lightweight","micro","networking","protobuf","server","tcp-server","websocket-server"],"created_at":"2024-07-30T20:01:31.375Z","updated_at":"2025-12-14T23:56:22.262Z","avatar_url":"https://github.com/lonng.png","language":"Go","readme":"# Nano [![Build Status][1]][2] [![GoDoc][3]][4] [![Go Report Card][5]][6] [![MIT licensed][7]][8] \n\n[1]: https://github.com/lonng/nano/actions/workflows/go.yml/badge.svg?branch=master\n[2]: https://github.com/lonng/nano/actions/workflows/go.yml\n[3]: https://godoc.org/github.com/lonng/nano?status.svg\n[4]: https://godoc.org/github.com/lonng/nano\n[5]: https://goreportcard.com/badge/github.com/lonng/nano\n[6]: https://goreportcard.com/report/github.com/lonng/nano\n[7]: https://img.shields.io/badge/license-MIT-blue.svg\n[8]: LICENSE\n\nNano is an easy to use, fast, lightweight game server networking library for Go.\nIt provides a core network architecture and a series of tools and libraries that\ncan help developers eliminate boring duplicate work for common underlying logic.\nThe goal of nano is to improve development efficiency by eliminating the need to\nspend time on repetitious network related programming.\n\nNano was designed for server-side applications like real-time games, social games,\nmobile games, etc of all sizes.\n\nJoin to Discord: [Nano Community](https://discord.gg/eHEDrBH5PV) \n\n## How to build a system with `Nano`\n\n#### What does a `Nano` application look like?\n\nThe simplest \"nano\" application as shown in the following figure, you can make powerful applications by combining different components.\n\n![Application](media/application.png)\n\nIn fact, the `nano` application is a collection of  [Component ](./docs/get_started.md#component) , and a component is a bundle of  [Handler](./docs/get_started.md#handler), once you register a component to nano, nano will register all methods that can be converted to `Handler` to nano service container. Service was accessed by `Component.Handler`, and the handler will be called while client request. The handler will receive two parameters while handling a message:\n  - `*session.Session`: corresponding a client that apply this request or notify.\n  - `*protocol.FooBar`: the payload of the request.\n\nWhile you had processed your logic, you can response or push message to the client by `session.Response(payload)` and `session.Push('eventName', payload)`, or returns error when some unexpected data received.\n\n#### How to build distributed system with `Nano`\n\nNano contains built-in distributed system solution, and make you creating a distributed game server easily.\n\nSee: [The distributed chat demo](https://github.com/lonng/nano/tree/master/examples/cluster)\n\nThe Nano will remain simple, but you can perform any operations in the component and get the desired goals. You can startup a group of `Nano` application as agent to dispatch message to backend servers.\n\n#### How to execute the asynchronous task\n\n```golang\nfunc (manager *PlayerManager) Login(s *session.Session, msg *ReqPlayerLogin) error {\n    var onDBResult = func(player *Player) {\n        manager.players = append(manager.players, player)\n        s.Push(\"PlayerSystem.LoginSuccess\", \u0026ResPlayerLogin)\n    }\n    \n    // run slow task in new gorontine\n    go func() {\n        player, err := db.QueryPlayer(msg.PlayerId) // ignore error in demo\n        // handle result in main logical gorontine\n        nano.Invoke(func(){ onDBResult(player) })\n    }\n    return nil\n}\n```\n\n## Documents\n\n- English\n    + [How to build your first nano application](./docs/get_started.md)\n    + [Route compression](./docs/route_compression.md)\n    + [Communication protocol](./docs/communication_protocol.md)\n    + [Design patterns](./docs/design_patterns.md)\n    + [API Reference(Server)](https://godoc.org/github.com/lonnng/nano)\n    + [How to integrate `Lua` into `Nano` component(incomplete)](.)\n\n- 简体中文\n    + [如何构建你的第一个nano应用](./docs/get_started_zh_CN.md)\n    + [路由压缩](./docs/route_compression_zh_CN.md)\n    + [通信协议](./docs/communication_protocol_zh_CN.md)\n    + [API参考(服务器)](https://godoc.org/github.com/lonnng/nano)\n    + [如何将`lua`脚本集成到`nano`组件中(未完成)](.)\n\n## Resources\n\n- Javascript\n  + [nano-websocket-client](https://github.com/lonnng/nano-websocket-client)\n  + [nano-egret-client](https://github.com/lonnng/nano-egret-client)\n\n- Typescript/cocos-creator\n  + [nano-client-ts](https://github.com/adoontheway/nano-client-ts)\n\n- Demo\n  + [Implement a chat room in 100 lines with nano and WebSocket](./examples/demo/chat)\n  + [Tadpole demo](./examples/demo/tadpole)\n  + [四川麻将, 血战到底(三人模式/四人模式)完整项目实例](https://github.com/lonnng/nanoserver)\n\n## Community\n\n- QQGroup: [289680347](https://jq.qq.com/?_wv=1027\u0026k=4EMMaha)\n- Reddit: [nanolabs](https://www.reddit.com/r/nanolabs/)\n\n## Successful cases\n\n- [空来血战](https://fir.im/tios)\n\n## Go version\n\n`\u003e go1.8`\n\n## Installation\n\n```bash\ngo get github.com/lonng/nano\n\n# dependencies\ngo get -u github.com/pingcap/check\ngo get -u github.com/pingcap/errors\ngo get -u github.com/urfave/cli\n\ngo get -u google.golang.org/protobuf/proto\ngo get -u github.com/gorilla/websocket\ngo get -u google.golang.org/grpc\n```\n\n## Protocol Buffers\n```bash\n# protoc\n# download form: https://github.com/protocolbuffers/protobuf/releases\n# protoc-gen-go\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest\ngo install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest\n# delve\ngo install github.com/go-delve/delve/cmd/dlv@latest\n```\n\n## Test\n```bash\ngo test -v ./...\n```\n\n## Benchmark\n\n```bash\n# Case:   PingPong\n# OS:     Windows 10\n# Device: i5-6500 3.2GHz 4 Core/1000-Concurrent   =\u003e IOPS 11W(Average)\n# Other:  ...\n\ncd ./benchmark/io\ngo test -v -tags \"benchmark\"\n```\n\n## License\n\n[MIT License](./LICENSE)\n","funding_links":[],"categories":["开源类库","Go","Open source library","Game Development","游戏开发","Relational Databases"],"sub_categories":["游戏相关","Game Related","Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","SQL 查询语句构建库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonng%2Fnano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flonng%2Fnano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonng%2Fnano/lists"}