{"id":17912669,"url":"https://github.com/danielgatis/go-discovery","last_synced_at":"2025-03-23T22:34:49.665Z","repository":{"id":57646919,"uuid":"442619818","full_name":"danielgatis/go-discovery","owner":"danielgatis","description":"A collection of service discovery implementations.","archived":false,"fork":false,"pushed_at":"2023-10-11T23:24:19.000Z","size":117,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T00:07:01.754Z","etag":null,"topics":["go","golang","kubernetes","mdns","service-discovery"],"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/danielgatis.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":"2021-12-29T00:39:14.000Z","updated_at":"2023-05-26T11:10:44.000Z","dependencies_parsed_at":"2024-10-28T19:56:50.156Z","dependency_job_id":null,"html_url":"https://github.com/danielgatis/go-discovery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-discovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-discovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-discovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-discovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgatis","download_url":"https://codeload.github.com/danielgatis/go-discovery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245180320,"owners_count":20573646,"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":["go","golang","kubernetes","mdns","service-discovery"],"created_at":"2024-10-28T19:46:28.666Z","updated_at":"2025-03-23T22:34:49.346Z","avatar_url":"https://github.com/danielgatis.png","language":"Go","funding_links":["https://www.buymeacoffee.com/danielgatis"],"categories":[],"sub_categories":[],"readme":"# Go - Discovery\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/danielgatis/go-discovery?style=flat-square)](https://goreportcard.com/report/github.com/danielgatis/go-discovery)\n[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/danielgatis/go-discovery/master/LICENSE)\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/danielgatis/go-discovery)\n\nA collection of service discovery implementations.\n\n## Install\n\n```bash\ngo get -u github.com/danielgatis/go-discovery\n```\n\nAnd then import the package in your code:\n\n```go\nimport \"github.com/danielgatis/go-discovery\"\n```\n\n### Example\n\nAn example described below is one of the use cases.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/danielgatis/go-ctrlc\"\n\t\"github.com/danielgatis/go-discovery\"\n\t\"github.com/sirupsen/logrus\"\n)\n\nvar (\n\tport int\n)\n\nfunc init() {\n\tflag.IntVar(\u0026port, \"port\", 3001, \"port number\")\n}\n\nfunc main() {\n\tflag.Parse()\n\n\tdiscovery := discovery.NewMdnsDiscovery(fmt.Sprintf(\"test:%d\", port), \"_test._tcp\", \"local.\", port, logrus.StandardLogger())\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\n\tctrlc.Watch(func() {\n\t\tcancel()\n\t})\n\n\tgo func() {\n\t\tdiscovery.Register(ctx)\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\tpeers, err := discovery.Lookup()\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatal(err)\n\t\t\t}\n\n\t\t\tfor _, peer := range peers {\n\t\t\t\tlogrus.Info(peer)\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n```\n❯ go run main.go -p 3001\n❯ go run main.go -p 3002\n```\n\n### License\n\nCopyright (c) 2021-present [Daniel Gatis](https://github.com/danielgatis)\n\nLicensed under [MIT License](./LICENSE)\n\n### Buy me a coffee\n\nLiked some of my work? Buy me a coffee (or more likely a beer)\n\n\u003ca href=\"https://www.buymeacoffee.com/danielgatis\" target=\"_blank\"\u003e\u003cimg src=\"https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fgo-discovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgatis%2Fgo-discovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fgo-discovery/lists"}