{"id":13582259,"url":"https://github.com/brutella/dnssd","last_synced_at":"2025-05-15T14:04:38.809Z","repository":{"id":27125486,"uuid":"103530053","full_name":"brutella/dnssd","owner":"brutella","description":"This library implements Multicast DNS (mDNS) and DNS-Based Service Discovery (DNS-SD) for Zero Configuration Networking in Go.","archived":false,"fork":false,"pushed_at":"2025-02-10T08:04:10.000Z","size":485,"stargazers_count":217,"open_issues_count":6,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T17:05:26.686Z","etag":null,"topics":["dns-sd","mdns","zeroconf"],"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/brutella.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":"2017-09-14T12:35:02.000Z","updated_at":"2025-04-06T04:59:34.000Z","dependencies_parsed_at":"2024-03-27T11:46:09.645Z","dependency_job_id":"ee74d423-a839-4739-9df6-4def0332ee91","html_url":"https://github.com/brutella/dnssd","commit_stats":{"total_commits":134,"total_committers":17,"mean_commits":7.882352941176471,"dds":"0.17164179104477617","last_synced_commit":"91c1c03a61e63eaf885854c3d7bc9afd0df05827"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brutella%2Fdnssd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brutella%2Fdnssd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brutella%2Fdnssd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brutella%2Fdnssd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brutella","download_url":"https://codeload.github.com/brutella/dnssd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"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":["dns-sd","mdns","zeroconf"],"created_at":"2024-08-01T15:02:32.707Z","updated_at":"2025-05-15T14:04:38.787Z","avatar_url":"https://github.com/brutella.png","language":"Go","readme":"# DNS-SD\n\n[![Build Status](https://travis-ci.org/brutella/hc.svg)](https://travis-ci.org/brutella/dnssd)\n\nThis library implements [Multicast DNS][mdns] and [DNS-Based Service Discovery][dnssd] to provide zero-configuration operations. It lets you announce and find services in a specific link-local domain.\n\n[mdns]: https://tools.ietf.org/html/rfc6762\n[dnssd]: https://tools.ietf.org/html/rfc6763\n\n## Usage\n\n#### Create a mDNS responder\n\nThe following code creates a service with name \"My Website._http._tcp.local.\" for the host \"My Computer\" which has all IPs from network interface \"eth0\". The service is added to a responder.\n\n```go\nimport (\n\t\"context\"\n\t\"github.com/brutella/dnssd\"\n)\n\ncfg := dnssd.Config{\n    Name:   \"My Website\",\n    Type:   \"_http._tcp\",\n    Domain: \"local\",\n    Host:   \"My Computer\",\n    Ifaces: []string{\"eth0\"},,\n    Port:   12345,\n}\nsv, _ := dnssd.NewService(cfg)\n```\n\nIn most cases you only need to specify the name, type and port of the service.\n\n```go\ncfg := dnssd.Config{\n    Name:   \"My Website\",\n    Type:   \"_http._tcp\",\n    Port:   12345,\n}\nsv, _ := dnssd.NewService(cfg)\n```\n\nThen you create a responder and add the service to it.\n```go\nrp, _ := dnssd.NewResponder()\nhdl, _ := rp.Add(sv)\n\nctx, cancel := context.WithCancel(context.Background())\ndefer cancel()\n\nrp.Respond(ctx)\n```\n\nWhen calling `Respond` the responder probes for the service instance name and host name to be unqiue in the network. \nOnce probing is finished, the service will be announced.\n\n#### Update TXT records\n\nOnce a service is added to a responder, you can use the `hdl` to update properties.\n\n```go\nhdl.UpdateText(map[string]string{\"key1\": \"value1\", \"key2\": \"value2\"}, rsp)\n```\n\n## `dnssd` command\n\nThe command line tool in `cmd/dnssd` lets you browse, register and resolve services similar to [dns-sd](https://www.unix.com/man-page/osx/1/dns-sd/).\n\n### Install\nYou can install the tool with\n\n`go install github.com/brutella/dnssd/cmd/dnssd`\n\n### Usage\n\n**Registering a service on your local machine**\n\nLets register a printer service (`_printer._tcp`) running on your local computer at port 515 with the name \"Private Printer\".\n\n```sh\ndnssd register -Name=\"Private Printer\" -Type=\"_printer._tcp\" -Port=515\n```\n\n**Registering a proxy service**\n\nIf the service is running on a different machine on your local network, you have to specify the hostname and IP.\nLets say the printer service is running on the printer with the hostname `ABCD` and IPv4 address `192.168.1.53`, you can register a proxy which announce that service on your network.\n\n```sh\ndnssd register -Name=\"Private Printer\" -Type=\"_printer._tcp\" -Port=515 -IP=192.168.1.53 -Host=ABCD\n```\n\nUse option `-Interface`, if you want to announce the service only on a specific network interface.\nThis might be necessary if your local machine is connected to multiple subnets and your announced service is only available on a specific subnet.\n\n```sh\ndnssd register -Name=\"Private Printer\" -Type=\"_printer._tcp\" -Port=515 -IP=192.168.1.53 -Host=ABCD -Interface=en0\n```\n\n**Browsing for a service**\n\nIf you want to browse for a service type, you can use the `browse` command.\n\n```sh\ndnssd browse -Type=\"_printer._tcp\"\n```\n\n**Resolving a service instance**\n\nIf you know the name of a service instance, you can resolve its hostname with the `resolve` command.\n\n```sh\ndnssd resolve -Name=\"Private Printer\" -Type=\"_printer._tcp\"\n```\n\n## Conformance\n\nThis library passes the [multicast DNS tests](https://github.com/brutella/dnssd/blob/36a2d8c541aab14895fc5492d5ad8ec447a67c47/_cmd/bct/ConformanceTestResults) of Apple's Bonjour Conformance Test.\n\n## TODO\n\n- [ ] Support hot plugging\n- [ ] Support negative responses (RFC6762 6.1)\n- [ ] Handle txt records case insensitive\n- [ ] Remove outdated services from cache regularly\n- [ ] Make sure that hostnames are FQDNs\n\n# Contact\n\nMatthias Hochgatterer\n\nGithub: [https://github.com/brutella](https://github.com/brutella/)\n\nTwitter: [https://twitter.com/brutella](https://twitter.com/brutella)\n\n\n# License\n\n*dnssd* is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrutella%2Fdnssd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrutella%2Fdnssd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrutella%2Fdnssd/lists"}