{"id":37091121,"url":"https://github.com/things-go/go-modbus","last_synced_at":"2026-01-14T11:02:27.454Z","repository":{"id":37402536,"uuid":"187741202","full_name":"things-go/go-modbus","owner":"things-go","description":"(Archived)modbus write in pure go, support rtu,ascii,tcp master library,also support tcp slave.(WIP new implement\u003cold: https://github.com/thinkgos/gomodbus \u003e)","archived":true,"fork":false,"pushed_at":"2023-03-04T01:52:34.000Z","size":189,"stargazers_count":158,"open_issues_count":7,"forks_count":58,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-18T21:45:20.570Z","etag":null,"topics":["go-modbus","modbus","modbus-ascii","modbus-master","modbus-rtu","modbus-slave","modbus-tcp"],"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/things-go.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-21T01:44:50.000Z","updated_at":"2024-05-07T16:36:21.000Z","dependencies_parsed_at":"2024-06-18T21:30:09.074Z","dependency_job_id":"882a371d-e116-4da2-bf0e-1e47905b5f40","html_url":"https://github.com/things-go/go-modbus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/things-go/go-modbus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/things-go%2Fgo-modbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/things-go%2Fgo-modbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/things-go%2Fgo-modbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/things-go%2Fgo-modbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/things-go","download_url":"https://codeload.github.com/things-go/go-modbus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/things-go%2Fgo-modbus/sbom","scorecard":{"id":881196,"data":{"date":"2025-08-11","repo":{"name":"github.com/things-go/go-modbus","commit":"5e82d75ae1c414c6db9ad265e0bcd04515e50089"},"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":"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":"SAST","score":10,"reason":"SAST tool detected: CodeQL","details":["Info: SAST configuration detected: CodeQL","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":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/lint.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr_review_dog.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/pr_review_dog.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr_review_dog.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/pr_review_dog.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr_review_dog.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/things-go/go-modbus/pr_review_dog.yml/master?enable=pin","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party 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":"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":"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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Warn: no topLevel permission defined: .github/workflows/lint.yml:1","Warn: no topLevel permission defined: .github/workflows/pr_review_dog.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":"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":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/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"}}]},"last_synced_at":"2025-08-24T08:16:06.976Z","repository_id":37402536,"created_at":"2025-08-24T08:16:06.976Z","updated_at":"2025-08-24T08:16:06.976Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-modbus","modbus","modbus-ascii","modbus-master","modbus-rtu","modbus-slave","modbus-tcp"],"created_at":"2026-01-14T11:02:26.796Z","updated_at":"2026-01-14T11:02:27.449Z","avatar_url":"https://github.com/things-go.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go modbus\n## NOTE: Archived, not maintain.\n## NOTE: 已归档, 不再维护, 放弃License. 有需要的可以自由分发\nmodbus write in pure go, support rtu,ascii,tcp master library,also support tcp slave.\n\n[![GoDoc](https://godoc.org/github.com/things-go/go-modbus?status.svg)](https://godoc.org/github.com/things-go/go-modbus)\n[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-blue?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/things-go/go-modbus/v2?tab=doc)\n[![codecov](https://codecov.io/gh/things-go/go-modbus/branch/master/graph/badge.svg)](https://codecov.io/gh/things-go/go-modbus)\n![Action Status](https://github.com/things-go/go-modbus/workflows/Go/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/things-go/go-modbus)](https://goreportcard.com/report/github.com/things-go/go-modbus)\n[![Licence](https://img.shields.io/github/license/things-go/go-modbus)](https://raw.githubusercontent.com/things-go/go-modbus/master/LICENSE)\n[![Tag](https://img.shields.io/github/v/tag/things-go/go-modbus)](https://github.com/things-go/go-modbus/tags)\n[![Sourcegraph](https://sourcegraph.com/github.com/things-go/go-modbus/-/badge.svg)](https://sourcegraph.com/github.com/things-go/go-modbus?badge)\n\n\n### Supported formats\n\n- modbus Serial(RTU,ASCII) Client\n- modbus TCP Client\n- modbus TCP Server\n\n### Features\n\n- object pool design,reduce memory allocation\n- fast encode and decode\n- interface design\n- simple API and support raw data api\n\n### Installation\n\nUse go get.\n```bash\n    go get github.com/things-go/go-modbus\n```\n\nThen import the package into your own code.\n```bash\n    import modbus \"github.com/things-go/go-modbus\"\n```\n\n### Supported functions\n\n---\n\nbit access:\n*   Read Discrete Inputs\n*   Read Coils\n*   Write Single Coil\n*   Write Multiple Coils\n\n16-bit access:\n*   Read Input Registers\n*   Read Holding Registers\n*   Write Single Register\n*   Write Multiple Registers\n*   Read/Write Multiple Registers\n*   Mask Write Register\n*   Read FIFO Queue\n\n### Example\n\n---\n\nmodbus RTU/ASCII client see [example](_examples/client_rtu_ascii)\n\n[embedmd]:# (_examples/client_rtu_ascii/main.go go)\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/goburrow/serial\"\n\n\tmodbus \"github.com/things-go/go-modbus\"\n)\n\nfunc main() {\n\tp := modbus.NewRTUClientProvider(modbus.WithEnableLogger(),\n\t\tmodbus.WithSerialConfig(serial.Config{\n\t\t\tAddress:  \"/dev/ttyUSB0\",\n\t\t\tBaudRate: 115200,\n\t\t\tDataBits: 8,\n\t\t\tStopBits: 1,\n\t\t\tParity:   \"N\",\n\t\t\tTimeout:  modbus.SerialDefaultTimeout,\n\t\t}))\n\n\tclient := modbus.NewClient(p)\n\terr := client.Connect()\n\tif err != nil {\n\t\tfmt.Println(\"connect failed, \", err)\n\t\treturn\n\t}\n\tdefer client.Close()\n\n\tfmt.Println(\"starting\")\n\tfor {\n\t\t_, err := client.ReadCoils(3, 0, 10)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\n\t\t//\tfmt.Printf(\"ReadDiscreteInputs %#v\\r\\n\", results)\n\n\t\ttime.Sleep(time.Second * 2)\n\t}\n}\n```\n\n\nmodbus TCP client see [example](_examples/client_tcp)\n\n[embedmd]:# (_examples/client_tcp/main.go go)\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\tmodbus \"github.com/things-go/go-modbus\"\n)\n\nfunc main() {\n\tp := modbus.NewTCPClientProvider(\"192.168.199.188:502\", modbus.WithEnableLogger())\n\tclient := modbus.NewClient(p)\n\terr := client.Connect()\n\tif err != nil {\n\t\tfmt.Println(\"connect failed, \", err)\n\t\treturn\n\t}\n\tdefer client.Close()\n\n\tfmt.Println(\"starting\")\n\tfor {\n\t\t_, err := client.ReadCoils(1, 0, 10)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\n\t\t//\tfmt.Printf(\"ReadDiscreteInputs %#v\\r\\n\", results)\n\n\t\ttime.Sleep(time.Second * 2)\n\t}\n}\n```\n\nmodbus TCP server see [example](_examples/server_tcp)\n\n[embedmd]:# (_examples/server_tcp/main.go go)\n```go\npackage main\n\nimport (\n\tmodbus \"github.com/things-go/go-modbus\"\n)\n\nfunc main() {\n\tsrv := modbus.NewTCPServer()\n\tsrv.LogMode(true)\n\tsrv.AddNodes(\n\t\tmodbus.NewNodeRegister(\n\t\t\t1,\n\t\t\t0, 10, 0, 10,\n\t\t\t0, 10, 0, 10),\n\t\tmodbus.NewNodeRegister(\n\t\t\t2,\n\t\t\t0, 10, 0, 10,\n\t\t\t0, 10, 0, 10),\n\t\tmodbus.NewNodeRegister(\n\t\t\t3,\n\t\t\t0, 10, 0, 10,\n\t\t\t0, 10, 0, 10))\n\n\terr := srv.ListenAndServe(\":502\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n### References\n\n---\n\n- [Modbus Specifications and Implementation Guides](http://www.modbus.org/specs.php)\n- [goburrow](https://github.com/goburrow/modbus)\n\n### JetBrains OS licenses\ngo-modbus had been being developed with GoLand under the free JetBrains Open Source license(s) granted by JetBrains s.r.o., hence I would like to express my thanks here.\n\n\u003ca href=\"https://www.jetbrains.com/?from=things-go/go-modbus\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/thinkgos/thinkgos/blob/master/asserts/jetbrains-variant-4.svg\" width=\"200\" align=\"middle\"/\u003e\u003c/a\u003e\n\n### Donation\n\nif package help you a lot,you can support us by:\n\n**Alipay**\n\n![alipay](https://github.com/thinkgos/thinkgos/blob/master/asserts/alipay.jpg)\n\n**WeChat Pay**\n\n![wxpay](https://github.com/thinkgos/thinkgos/blob/master/asserts/wxpay.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthings-go%2Fgo-modbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthings-go%2Fgo-modbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthings-go%2Fgo-modbus/lists"}