{"id":18366986,"url":"https://github.com/injoyai/io","last_synced_at":"2026-02-26T18:15:46.375Z","repository":{"id":77142702,"uuid":"586477874","full_name":"injoyai/io","owner":"injoyai","description":"万物皆IO,老和io包引入冲突,核心功能准备迁移至ios","archived":false,"fork":false,"pushed_at":"2025-04-30T05:54:33.000Z","size":13885,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T06:36:38.713Z","etag":null,"topics":["io","proxy","serial","tcp","udp","websokcet"],"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/injoyai.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-08T09:37:15.000Z","updated_at":"2025-04-30T05:54:06.000Z","dependencies_parsed_at":"2023-09-23T01:44:04.616Z","dependency_job_id":"5f020ea3-ccde-41d6-b99e-2bdae15086ec","html_url":"https://github.com/injoyai/io","commit_stats":{"total_commits":310,"total_committers":3,"mean_commits":"103.33333333333333","dds":"0.28387096774193543","last_synced_commit":"4a6b5610fc6bad75a974c526eba85f3e95e465f8"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/injoyai/io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/injoyai%2Fio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/injoyai%2Fio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/injoyai%2Fio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/injoyai%2Fio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/injoyai","download_url":"https://codeload.github.com/injoyai/io/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/injoyai%2Fio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264023552,"owners_count":23545689,"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","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":["io","proxy","serial","tcp","udp","websokcet"],"created_at":"2024-11-05T23:19:34.266Z","updated_at":"2026-02-26T18:15:41.227Z","avatar_url":"https://github.com/injoyai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# io\n\n\n### 如何使用\n项目已移至 [`https://github.com/injoyai/ios`](https://github.com/injoyai/ios)\n\n#### 如何连接TCP\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/injoyai/io\"\n\t\"github.com/injoyai/io/dial\"\n\t\"time\"\n)\n\nfunc main() {\n\taddr := \"127.0.0.1:10086\"\n\tc := io.Redial(dial.WithTCP(addr),\n\t\tfunc(c *io.Client) {\n\t\t\tc.Debug()             //开启打印日志\n\t\t\tc.SetPrintWithUTF8() //打印日志编码ASCII\n\t\t\tc.SetReadWith1KB()    //设置读取方式,一次读取全部\n\t\t\tc.SetDealFunc(func(c *io.Client, msg io.Message) {\n\t\t\t\t// todo 业务逻辑,处理读取到的数据\n\t\t\t})\n\t\t\tc.GoTimerWriter(time.Minute, func(w *io.Client) error {\n\t\t\t\t_,err:= w.WriteString(\"心跳\") //定时发送心跳\n\t\t\t\treturn err\n\t\t\t})\n\t\t})\n\t\u003c-c.DoneAll()\n}\n\n```\n\n#### 如何连接SSH\n\n```go\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"github.com/injoyai/io\"\n\t\"github.com/injoyai/io/dial\"\n\t\"os\"\n)\n\nfunc main() {\n\tc := dial.RedialSSH(\u0026dial.SSHConfig{\n\t\tAddr:     os.Args[1],\n\t\tUser:     os.Args[2],\n\t\tPassword: os.Args[3],\n\t})\n\tc.Debug(false)\n\tc.SetDealFunc(func(c *io.Client, msg io.Message) {\n\t\tfmt.Print(msg.String())\n\t})\n\tgo c.Run()\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tselect {\n\t\tcase \u003c-c.DoneAll():\n\t\t\treturn\n\t\tdefault:\n\t\t\tbs, _, _ := reader.ReadLine()\n\t\t\tc.Write(bs)\n\t\t}\n\t}\n}\n\n\n```\n\n#### 如何连接Websocket\n\n```go\npackage main\n\nimport(\n\t\"bufio\"\n\t\"github.com/injoyai/io\"\n\t\"github.com/injoyai/io/dial\"\n\t\"os\"\n)\n\nfunc main(){\n\t\u003c- dial.RedialWebsocket(\"http://127.0.0.1:80/ws\",nil,\n\t\tfunc(c *io.Client) {\n\t\t\tc.Debug()\n\t\t\tc.SetPrintWithUTF8()\n\t\t\tc.SetDealFunc(func(c *io.Client, msg io.Message) {\n                //处理数据\n\t\t\t})\n        }).DoneAll()\n\t\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finjoyai%2Fio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finjoyai%2Fio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finjoyai%2Fio/lists"}