{"id":15502571,"url":"https://github.com/ofmooseandmen/halo","last_synced_at":"2025-04-10T03:34:04.043Z","repository":{"id":57721893,"uuid":"119231803","full_name":"ofmooseandmen/halo","owner":"ofmooseandmen","description":"An implementation of Multicast DNS Service Discovery in Java.","archived":false,"fork":false,"pushed_at":"2020-05-10T08:07:14.000Z","size":598,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T04:50:53.458Z","etag":null,"topics":["bonjour","java","mdns","multicast-dns","service-discovery"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ofmooseandmen.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}},"created_at":"2018-01-28T05:46:43.000Z","updated_at":"2024-10-23T18:25:04.000Z","dependencies_parsed_at":"2022-09-26T21:50:25.776Z","dependency_job_id":null,"html_url":"https://github.com/ofmooseandmen/halo","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/ofmooseandmen%2Fhalo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofmooseandmen%2Fhalo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofmooseandmen%2Fhalo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofmooseandmen%2Fhalo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ofmooseandmen","download_url":"https://codeload.github.com/ofmooseandmen/halo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248151891,"owners_count":21056182,"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":["bonjour","java","mdns","multicast-dns","service-discovery"],"created_at":"2024-10-02T09:10:19.385Z","updated_at":"2025-04-10T03:34:04.015Z","avatar_url":"https://github.com/ofmooseandmen.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Halo\n\n[![CI](https://github.com/ofmooseandmen/halo/workflows/CI/badge.svg)](https://github.com/ofmooseandmen/halo/actions?query=workflow%3ACI)\n[![codecov.io](https://codecov.io/github/ofmooseandmen/halo/branches/master/graphs/badge.svg)](https://codecov.io/github/ofmooseandmen/halo)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.ofmooseandmen/halo.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.github.ofmooseandmen%22%20AND%20a%3A%22halo%22)\n[![Javadocs](https://www.javadoc.io/badge/com.github.ofmooseandmen/halo.svg?color=lightgrey)](https://www.javadoc.io/doc/com.github.ofmooseandmen/halo)\n[![license](https://img.shields.io/badge/license-BSD3-lightgray.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\n\u003e __Halo__ [_Javanese_] is __Bonjour__ [_French_] is __Hello__ [_English_]\n\nAn implementation of [Multicast DNS Service Discovery](https://en.wikipedia.org/wiki/Zero-configuration_networking#Service_discovery) in Java.\n\n## Building from Source\n\nYou need [JDK-8](http://jdk.java.net/8) or higher to build Halo.\nHalo can be built with Gradle using the following command:\n\n```\n./gradlew clean build\n```\n\n## Tests\n\nHalo is tested with [cucumber](https://cucumber.io) against [JmDNS](https://github.com/jmdns/jmdns). Feature files can be found in the `src/test/resources` folder.\n\n## Usage\n\n### Service Registration\n\n```java\ntry (final Halo halo = Halo.allNetworkInterfaces(Clock.systemDefaultZone())) {\n    // allowing service instance name to be changed and with a default TTL of 1 hour:\n    Registered service = halo.register(RegisterableService.create(\"Foo Bar\", \"_http._udp.\", 8009).get());\n    // registered service is returned:\n    System.err.println(service);\n\n    // registering again the service instance and registration type will return a service\n    // with an instance name of \"Foo Bar (2)\":\n    service = halo.register(RegisterableService.create(\"Foo Bar\", \"_http._udp.\", 8010).get());\n    System.err.println(service);\n\n    // not allowing service instance name to be changed will throw an IOException at this point:\n    halo.register(RegisterableService.create(\"Foo Bar\", \"_http._udp.\", 8011).get(), false);\n    \n    // if blocking until the service has been announced is not acceptable:\n    ExecutorService es = Executors.newSingleThreadExecutor();\n    Future\u003cRegistered\u003e future =\n            es.submit(() -\u003e halo.register(RegisterableService.create(\"Future\", \"_http._udp.\", 8009).get()));\n\n    // changing the attributes of a registered service.\n    Attributes newAttributes = Attributes.create().with(\"Changed\").get();\n    service.changeAttributes(newAttributes);\n    // or\n    Future\u003cVoid\u003e future = es.submit(() -\u003e service.changeAttributes(newAttributes));\n\n}\n```\n\n### Service Resolution\n\n```java\ntry (final Halo halo = Halo.allNetworkInterfaces(Clock.systemDefaultZone())) {\n    // default timeout of 6 seconds:\n    Optional\u003cResolvedService\u003e service = halo.resolve(\"Foo Bar\", \"_http._udp.\");\n    // Optional contains the service if it could be resolved, empty otherwise:\n    System.err.println(service);\n    \n    // user defined timeout:\n    service = halo.resolve(\"Foo Bar\", \"_http._udp.\", Duration.ofSeconds(1));\n    System.err.println(service);\n\n    // if blocking until the service has been resolved is not acceptable:\n    ExecutorService es = Executors.newSingleThreadExecutor();\n    Future\u003cOptional\u003cResolvedService\u003e\u003e future = es.submit(() -\u003e halo.resolved(\"Foo Bar\", \"_http._udp.\"));\n}\n```\n\n### Services Browsing by Registration Type\n\n```java\ntry (final Halo halo = Halo.allNetworkInterfaces(Clock.systemDefaultZone())) {\n    final ServiceBrowserListener l = new ServiceBrowserListener() {\n\n        @Override\n        public final void serviceAdded(final ResolvedService service) {\n            System.err.println(service + \" has been added to the network!!!!!\");\n        }\n\n        @Override\n        public final void serviceRemoved(final ResolvedService service) {\n            System.err.println(service + \" has been removed from the network!!!!!\");\n        }\n\n        @Override\n        public final void serviceUpdated(final ResolvedService service) {\n            System.err.println(service + \" has been updated!!!!!\");\n        }\n\n    };\n\n    final Browser browser = halo.browse(\"_http._udp.\", l);\n\n    // Wait for some services to be registered on the network...\n    Thread.sleep(5000);\n\n    browser.close();\n}\n```\n\n### Registration Types Browsing\n\n```java\ntry (final Halo halo = Halo.allNetworkInterfaces(Clock.systemDefaultZone())) {\n    final Browser browser = halo.browse(System.err::printLn);\n\n    // Wait for some services to be registered on the network...\n    Thread.sleep(5000);\n\n    browser.close();\n}\n```\n\n## Configuration\nThe following parameters can be configured by system properties:\n\n| Property Key                       | Description                                                           | Default     |\n| ---------------------------------- | --------------------------------------------------------------------- | ----------- |\n| io.omam.halo.mdns.ipv4             | mDNS IPV4 address                                                     | 224.0.0.251 |\n| io.omam.halo.mdns.ipv6             | mDNS IPV6 address                                                     | FF02::FB    |\n| io.omam.halo.mdns.port             | mDNS port                                                             | 5353        |\n| io.omam.halo.resolution.timeout    | resolution timeout in milliseconds                                    | 6000        |\n| io.omam.halo.resolution.interval   | interval between resolution questions in milliseconds                 | 200         |\n| io.omam.halo.probing.timeout       | probing timeout in milliseconds                                       | 6000        |\n| io.omam.halo.probing.interval      | interval between probe messages in milliseconds                       | 250         |\n| io.omam.halo.probing.number        | number of probing messages before announcing a registered service     | 3           |\n| io.omam.halo.announcement.interval | interval between announcement messages in milliseconds                | 1000        |\n| io.omam.halo.announcement.number   | number of announcement messages to registered service                 | 2           |\n| io.omam.halo.querying.first        | delay before transmitting the first browsing query in milliseconds    | 50          |\n| io.omam.halo.querying.delay        | interval between consecutive browsing queries in milliseconds         | 1000        |\n| io.omam.halo.querying.increase     | increase factor between consecutive browsing queries                  | 2           |\n| io.omam.halo.querying.max          | maximum interval between consecutive browsing queries in milliseconds | 1200000     |\n| io.omam.halo.cancellation.interval | interval between goodbye messages in milliseconds                     | 250         |\n| io.omam.halo.cancellation.number   | number of goodbye messages sent when de-registering a service         | 3           |\n| io.omam.halo.reaper.interval       | cache record reaper interval in milliseconds                          | 10000       |\n| io.omam.halo.ttl.default           | DNS record default time to live in milliseconds                       | 3600000     |\n| io.omam.halo.ttl.expiry            | DNS record time to live after expiry in milliseconds                  | 1000        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofmooseandmen%2Fhalo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofmooseandmen%2Fhalo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofmooseandmen%2Fhalo/lists"}