{"id":33604204,"url":"https://github.com/faceless2/zeroconf","last_synced_at":"2026-03-07T17:01:10.039Z","repository":{"id":108690634,"uuid":"60546980","full_name":"faceless2/zeroconf","owner":"faceless2","description":"A very simple pure Java implementation of Multicast DNS SD (Service Discovery)","archived":false,"fork":false,"pushed_at":"2025-11-28T14:34:18.000Z","size":666,"stargazers_count":30,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-30T20:48:26.733Z","etag":null,"topics":["dns-sd","java","service-discovery","zeroconf"],"latest_commit_sha":null,"homepage":"","language":"Java","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/faceless2.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-06-06T17:24:52.000Z","updated_at":"2025-11-29T06:02:02.000Z","dependencies_parsed_at":"2025-11-30T10:03:08.985Z","dependency_job_id":null,"html_url":"https://github.com/faceless2/zeroconf","commit_stats":null,"previous_names":["faceless2/zeroconf"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/faceless2/zeroconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faceless2%2Fzeroconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faceless2%2Fzeroconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faceless2%2Fzeroconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faceless2%2Fzeroconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faceless2","download_url":"https://codeload.github.com/faceless2/zeroconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faceless2%2Fzeroconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30222347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T17:00:40.062Z","status":"ssl_error","status_checked_at":"2026-03-07T17:00:39.026Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["dns-sd","java","service-discovery","zeroconf"],"created_at":"2025-11-30T13:00:33.517Z","updated_at":"2026-03-07T17:01:10.023Z","avatar_url":"https://github.com/faceless2.png","language":"Java","funding_links":[],"categories":["网络编程"],"sub_categories":["Spring Cloud框架"],"readme":"# Zeroconf\n\nZeroconf is a simple Java implementation of [Multicast DNS Service Discovery](https://datatracker.ietf.org/doc/html/rfc6763), _aka_ the service discovery bit of Zeroconf.\nOriginally written as a quick hack to avoid having to use [https://github.com/jmdns/jmdns](https://github.com/jmdns/jmdns), it has evolved into something\nthat can both announce and listen for Services:\n\n* Listens on multiple interfaces (IPv4 and IPv6)\n* Network topology changes are handled transparently.\n* Sent packets include only the A and AAAA records that apply to the interface they're sent on\n* Requires Java 8+ and no other dependencies.\n* Javadocs at [https://faceless2.github.io/zeroconf/docs](https://faceless2.github.io/zeroconf/docs/)\n* Prebuilt binary at [https://faceless2.github.io/zeroconf/dist/zeroconf-1.0.3.jar](https://faceless2.github.io/zeroconf/dist/zeroconf-1.0.3.jar)\n\nHere's a simple example which announces a service on all interfaces on the local machine:\n\n```java\nimport com.bfo.zeroconf.*;\n\nZeroconf zc = new Zeroconf();\nService service = new Service.Builder()\n                    .setName(\"MyWeb\")\n                    .setType(\"_http._tcp\")\n                    .setPort(8080)\n                    .put(\"path\", \"/path/to/service\")\n                    .build(zc);\nservice.announce();\n// time passes\nservice.cancel();\n// time passes\nzc.close();\n```\n\nTo set custom TTLs for each mDNS record type:\n\n```java\nimport com.bfo.zeroconf.*;\n\nZeroconf zc = new Zeroconf();\nService.Builder builder = new Service.Builder()\n                    .setName(\"MyWeb\")\n                    .setType(\"_http._tcp\")\n                    .setPort(8080)\n                    .put(\"path\", \"/path/to/service\");\n\n// Custom TTLs for each mDNS record type.\nint ttl = 120;\nbuilder.setTTL_PTR(ttl);\nbuilder.setTTL_SRV(ttl);\nbuilder.setTTL_TXT(ttl);\nbuilder.setTTL_A(ttl);\nbuilder.build(zc);\n\n// Announce the service.\nservice.announce();\n```\n\nAnd to listen, either add a Listener for events or use the live, thread-safe Collection of Services.\n\n```java\nimport com.bfo.zeroconf.*;\n\nZeroconf zc = new Zeroconf();\nzc.addListener(new ZeroconfListener() {\n    public void serviceNamed(String type, String name) {\n        if (\"_http._tcp\".equals(type)) {\n            zc.query(type, name);  // Ask for details on any announced HTTP services\n        }\n    }\n    public void serviceAnnounced(Service service) {\n        // A new service has just been announced\n    }\n});\n\nzc.query(\"_http._tcp\", null); // Ask for any HTTP services\n\n// time passes\nfor (Service s : zc.getServices()) {\n  if (s.getType().equals(\"_http._tcp\") {\n     // A service has been announced at some point in the past, and has not yet expired.\n   }\n}\n\n// time passes\nzc.close();\n```\n\nTo disable IPv6 support, and to only listen on a single network interface with a given IP address, use:\n\n```java\nZeroconf zc = new Zeroconf();\nzc.setIPv6(false);\nzc.setLocalHostName(ip);\n\n// Add the single NIC with the given IP.\nNetworkInterface nic = NetworkUtils.findIPv4NICForIP(ip);\nif (nic != null) {\n    // Remove all configured NICs.\n    zc.getNetworkInterfaces().clear();\n\n    // Add the IPv4 NIC.\n    zc.getNetworkInterfaces().add(nic);\n}\n```\n\nTo build\n--\n\nRun `ant` to build the Jar in the `build` directory, and javadoc in the `doc` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaceless2%2Fzeroconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaceless2%2Fzeroconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaceless2%2Fzeroconf/lists"}