{"id":13393005,"url":"https://github.com/leozz37/hare","last_synced_at":"2026-01-26T07:37:33.294Z","repository":{"id":38094751,"uuid":"317684866","full_name":"leozz37/hare","owner":"leozz37","description":"🐇  CLI tool for websockets and Go package","archived":false,"fork":false,"pushed_at":"2022-08-31T14:57:08.000Z","size":382,"stargazers_count":53,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T19:38:38.297Z","etag":null,"topics":["go","golang","hare","messaging","network","socketio","sockets"],"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/leozz37.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2020-12-01T22:30:27.000Z","updated_at":"2024-09-03T21:21:10.000Z","dependencies_parsed_at":"2022-08-08T23:00:59.318Z","dependency_job_id":null,"html_url":"https://github.com/leozz37/hare","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/leozz37/hare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leozz37%2Fhare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leozz37%2Fhare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leozz37%2Fhare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leozz37%2Fhare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leozz37","download_url":"https://codeload.github.com/leozz37/hare/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leozz37%2Fhare/sbom","scorecard":{"id":585394,"data":{"date":"2025-08-18","repo":{"name":"github.com/leozz37/hare","commit":"a3d3dc7781c926569e8400cf4b494ab4d5219cf9"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":4.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:15:0: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context [syntax-check]","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:15:0: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context [syntax-check]","details":null,"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:15:0: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context [syntax-check]","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/11 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/40576783fda6698350fcbbeaea760ff827433034/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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:15:0: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context [syntax-check]","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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"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/40576783fda6698350fcbbeaea760ff827433034/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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.6.0 not signed: https://api.github.com/repos/leozz37/hare/releases/56218048","Warn: release artifact v0.5.0 not signed: https://api.github.com/repos/leozz37/hare/releases/48079228","Warn: release artifact v0.6.0 does not have provenance: https://api.github.com/repos/leozz37/hare/releases/56218048","Warn: release artifact v0.5.0 does not have provenance: https://api.github.com/repos/leozz37/hare/releases/48079228"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/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/40576783fda6698350fcbbeaea760ff827433034/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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:15:0: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context [syntax-check]","details":null,"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T20:21:45.019Z","repository_id":38094751,"created_at":"2025-08-20T20:21:45.019Z","updated_at":"2025-08-20T20:21:45.019Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28769852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T06:37:25.426Z","status":"ssl_error","status_checked_at":"2026-01-26T06:37:23.039Z","response_time":59,"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","hare","messaging","network","socketio","sockets"],"created_at":"2024-07-30T17:00:40.896Z","updated_at":"2026-01-26T07:37:33.278Z","avatar_url":"https://github.com/leozz37.png","language":"Go","readme":"# Hare Sockets 🐇\n\n\u003cimg align=\"right\" width=\"159px\" src=\"./resources/images/small-icon.png\"\u003e\n\n![Go](https://github.com/leozz37/hare/workflows/Go/badge.svg)\n[![codecov](https://codecov.io/gh/leozz37/hare/branch/main/graph/badge.svg?token=QC44PEpHRi)](https://codecov.io/gh/leozz37/hare)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/leozz37/hare)](https://goreportcard.com/report/github.com/leozz37/hare)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4a5488c02fd6481d826512536181a1eb)](https://app.codacy.com/gh/leozz37/hare?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=leozz37/hare\u0026utm_campaign=Badge_Grade)\n[![Maintainability](https://api.codeclimate.com/v1/badges/97a96b7d488b201aab7c/maintainability)](https://codeclimate.com/github/leozz37/hare/maintainability)\n[![GoDoc](https://pkg.go.dev/badge/github.com/leozz37/hare?status.svg)](https://pkg.go.dev/github.com/leozz37/hare?tab=doc)\n[![Join the chat at https://gitter.im/hare-sockets/community](https://badges.gitter.im/hare-sockets/community.svg)](https://gitter.im/hare-sockets/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Release](https://img.shields.io/github/v/release/leozz37/hare)](https://github.com/leozz37/hare/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nHare is an user-friendly package for sockets in Golang and a CLI tool for sockets interaction. You can send and listen to TCP connections with a few lines of code or commands.\n\n## Contents\n\n- [Installation](#installation)\n- [Quickstart](#quickstart)\n- [Documentation](#documentation)\n- [Examples](#examples)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## 🖥️ Installation\n\nInstallation guide for the CLI Tool and Golang Library.\n\n### 💻 CLI Tool\n\nTo install the CLI tool, you can install it through [Homebrew](https://brew.sh/):\n\n```shell\n$ brew tap leozz37/hare\n\n$ brew install hare\n```\n\nOr you can install manually with the `Makefile` script:\n\n```shell\n$ make install\n```\n\n### 🐇 Golang Lib\n\nFirst, you need [Go](https://golang.org/) (version 1.12+ is required), then you can install Hare:\n\n```shell\n$ go get -u \"github.com/leozz37/hare\"\n```\n\nImport it in your code:\n\n```shell\nimport \"github.com/leozz37/hare\"\n```\n\n## 🍕 Quickstart\n\nQuick start for the CLI Tool and the Golang Library.\n\n### 💻 CLI Tool\n\nTo use the CLI tool, these are the flags:\n\n```\n  -d string\n        Data to be sended\n  -h string\n        Host address to bo operated (default \"localhost\")\n  -l    Listen to a given address\n  -p string\n        Port address to bo operated         [REQUIRED]\n  -s    Send message to a given address\n```\n\nYou can run the `--help`  flag:\n\n```shell\n$ hare --help\n```\n\nTo `Listen` to port `3000` for example, run:\n\n```shell\n$ hare -l -p 3000\n```\n\nTo `Send` a payload with the message `Hello World` to port `3000` for example, run:\n\n```shell\n$ hare -s -p 3000 -d 'Hello World'\n```\n\n![cli-example](resources/images/cli-example.png)\n\n### 🐇 Golang Lib\n\n[Sample code](./examples/send.go) for sending payloads:\n\n```go\npackage main\n\nimport (\n    \"github.com/leozz37/hare\"\n)\n\nfunc main() {\n    hare.Send(3000, \"Hello, World\")\n}\n```\n\n[Sample code](./examples/listen.go) for listening a port:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/leozz37/hare\"\n)\n\nfunc main() {\n    r, _ := hare.Listen(\"3000\")\n\n    for {\n        if r.HasNewMessages() {\n            fmt.Println(r.GetMessage())\n        }\n    }\n}\n```\n\n## 📖 Documentation\n\nThe library consists of two features: **listen** and **send** to a given port. You can check the full documentation on [Godoc](https://pkg.go.dev/github.com/leozz37/hare#section-documentation).\n\n### Send\n\nReceives a `port` and a `message`, both as `string` and returns an `error` (if something goes wrong).\n\n```go\nfunc Send(port, message string) error;\n```\n\nUsage example:\n\n```go\nfunc main() {\n    err := hare.Send(3000, \"Hello, World\")\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n---\n\n### Listen\n\nReceives a `port` as `string` and returns a `Listener` struct and an `error` (if something goes wrong).\n\n```go\nfunc Listen(port string) (*Listener, error);\n```\n\nUsage example:\n\n```go\nfunc main() {\n    r, _ := hare.Listen(\"3000\")\n    l, _ := hare.listen(\"3001\")\n\n    for {\n        if r.HasNewMessages() {\n            fmt.Println(r.GetMessage())\n        } else if l.HasNewMessages() {\n            fmt.Println(l.GetMessage())\n        }\n    }\n```\n\n---\n\n### Listener\n\nThe **Listener** struct returned by `Listen()` function has the following fields:\n\n```go\ntype Listener struct {\n    SocketListener net.Listener\n    HasNewMessages func() bool\n    GetMessage     func() string\n    Stop           func()\n}\n```\n\n`SocketListener` is the socket connection.\n\n```go\nlistener.SocketListener, _ = net.Listen(\"tcp\", \"localhost:\" + port)\n```\n\n`HasNewMessages()` function returns a `bool` being `true` with there's a new message:\n\n```go\nfunc main() {\n    r, _ := hare.Listen(\"3000\")\n\n    if r.HasNewMessages() {\n        fmt.Println(\"There's a new message!\")\n    }\n}\n```\n\n`GetMessage()` function returns a `string` with the last message received on the socket:\n\n```go\nfunc main() {\n    r, _ := hare.Listen(\"3000\")\n\n    if r.HasNewMessages() {\n        fmt.Println(r.GetMessage())\n    }\n}\n```\n\n`Stop()` function closes the listener connection:\n\n```go\nfunc main() {\n    r, _ := hare.Listen(\"3000\")\n    hare.Send(\"3000\", \"Hey beauty\")\n\n    r.Stop()\n\n    err := Send(\"3000\", \"This should fails\")\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n## 📙 Examples\n\nYou can check the [example](./examples) for code usages, like [send](./examples/send.go) and [listen](./examples/listen.go) samples.\n\nSince Hare only listens and send messages, here's a complete example:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n\n    \"github.com/leozz37/hare\"\n)\n\nfunc listenSockets(port string) {\n    r, _ := hare.Listen(port)\n\n    for {\n        if r.HasNewMessages() {\n            fmt.Println(r.GetMessage())\n        }\n    }\n}\n\nfunc main() {\n    go listenSockets(\"3000\")\n    go listenSockets(\"3001\")\n\n    for {\n        hare.Send(\"3000\", \"Hello port 3000\")\n        hare.Send(\"3001\", \"Hello port 3001\")\n        time.Sleep(time.Second)\n    }\n}\n```\n\n## 🧪 Testing\n\nTo run the test suite, you can run with:\n\n```shell\n$ go test\n```\n\nIf you want a more detailed report with coverage and an `coverage.out` file, do the following:\n\n```shell\n$ go test -v -covermode=count -coverprofile=coverage.out\n```\n\n## 🤝 Contributing\n\nA full guideline about contributing to Hare can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file.\n\n## ⚖️ License\n\nHare is released under the [MIT License](./LICENSE).\n","funding_links":[],"categories":["Uncategorized","Messaging","消息","Relational Databases"],"sub_categories":["Uncategorized","Search and Analytic Databases","检索及分析资料库","Advanced Console UIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleozz37%2Fhare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleozz37%2Fhare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleozz37%2Fhare/lists"}