{"id":31840179,"url":"https://github.com/rtakland/native-mdns","last_synced_at":"2026-07-21T12:36:14.403Z","repository":{"id":317088693,"uuid":"1065922634","full_name":"RTAkland/native-mdns","owner":"RTAkland","description":"kotlin multiplatform mdns responder with kotlin native, supports jvm, linux, macos, windows","archived":false,"fork":false,"pushed_at":"2026-03-13T16:13:08.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-21T12:36:11.806Z","etag":null,"topics":["airplay","c","cpp","dns","kotlin","mdns","native"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RTAkland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-09-28T17:43:03.000Z","updated_at":"2026-03-13T16:13:13.000Z","dependencies_parsed_at":"2025-09-28T20:24:31.671Z","dependency_job_id":"6ef08102-a96e-4b78-a21c-29bf3cc07f14","html_url":"https://github.com/RTAkland/native-mdns","commit_stats":null,"previous_names":["rtakland/native-mdns"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/RTAkland/native-mdns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RTAkland%2Fnative-mdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RTAkland%2Fnative-mdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RTAkland%2Fnative-mdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RTAkland%2Fnative-mdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RTAkland","download_url":"https://codeload.github.com/RTAkland/native-mdns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RTAkland%2Fnative-mdns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35724450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-21T02:00:06.728Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["airplay","c","cpp","dns","kotlin","mdns","native"],"created_at":"2025-10-12T04:54:15.826Z","updated_at":"2026-07-21T12:36:14.398Z","avatar_url":"https://github.com/RTAkland.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# native-mdns\n\nA Kotlin multiplatform library for mdns announcer(mdns server), only broadcast is supported,\n\nAlso, nmdns can be compiled to shared/static lib for other languages calling, see [c++ example](#cpp)\n\nmDNS is usually used for Apple's AirPlay protocol family, there's an example in README.md [How to use](#How-to-use)\n\nSupported platforms:\n\n1. windows64(mingwx64)\n2. linuxX64\n3. linuxArm64\n4. macosArm64\n5. macosX64\n6. jvm(11 or later)\n\n\nPlatform implementations are based on:\n\n- Apple: posix socket\n- Windows: WinSock\n- Linux: posix socket\n- JVM: `java.net.MulticastSocket`\n\nNo external dependencies required.\n\nSupported record type\n\n1. A\n2. PTR\n3. SRV\n4. TXT\n\nSupported features\n\n1. Event hooking(Kotlin only)\n\n\u003e AAAA is not supported\n\nAirPlay2(_airplay._tcp.local.) is tested\n\n# How to use\n\n\u003e Make sure you added the mavenCentral repository in your project\n\n```kotlin\nkotlin {\n    linuxX64()\n    // Add other platforms\n\n    sourceSets {\n        commonMain.dependencies {\n            implementation(\"cn.rtast.nmdns:native-mdns:\u003cversion\u003e\")\n        }\n    }\n}\n```\n\nThere is a simple airplay2 service\n\n```kotlin\nval service = registerService(\n    serviceType = \"_airplay._tcp.local.\",\n    serviceName = \"AP@RTAST\",\n    hostname = \"rtakland.local.\",\n    ipAddress = \"192.168.10.104\",\n    port = 7001,\n    bindAddress = \"192.168.10.104\",\n    mdnsPort = 5356,\n    txtRecords = listOf(\"key1=value1\", \"key2=value2\")\n) {\n    // This block is optional\n    // Event hooking in this block\n    onBroadcast {\n        println(\"broadcasted\")\n    }\n\n    onRegister {\n        println(\"reg\")\n    }\n\n    onUnregistered {\n        println(\"unreg\")\n    }\n}\nwhile (true) {\n    service.broadcast()\n    delay(2000L) // or use cn.rtast.nmdns.sleep1(2) sleep 2 seconds, this function is not a suspended function\n}\n```\n\n# cpp\n\n```cpp\n#include \u003ccsignal\u003e\n#include \u003ccstdio\u003e\n#include \"libnmdns_api.h\"\n\nvolatile sig_atomic_t keepRunning = 1;\n\nvoid handle_sigint(int sig) {\n    std::printf(\"\\nCaught signal %d, exiting...\\n\", sig);\n    keepRunning = 0;\n}\n\nint main() {\n    libnmdns_kref_kotlin_collections_List txt = create_txt_records();\n\n    add_txt_record(txt, \"deviceid=ef:42:0d:76:f1:97\");\n    add_txt_record(txt, \"model=AppleTV3,2C\");\n    add_txt_record(txt, \"features=0x5A7FFFF7,0x1E\");\n    add_txt_record(txt, \"srcvers=220.68\");\n    add_txt_record(txt, \"pk=f3769a660475d27b4f6040381d784645e13e21c53e6d2da6a8c3d757086fc336\");\n\n    libnmdns_kref_cn_rtast_nmdns_NMDNSAnnouncer service = register_service(\n        \"_airplay._tcp.local.\",\n        \"AP@RTAST\",\n        \"rtakland.local.\",\n        \"192.168.10.104\",\n        7001, 3652, \"192.168.10.104\",\n        txt\n    );\n\n    std::signal(SIGINT, handle_sigint); \n    std::signal(SIGTERM, handle_sigint);\n    std::signal(SIGHUP, handle_sigint);\n    std::signal(SIGQUIT, handle_sigint);\n\n    std::printf(\"Running... Press Ctrl+C to exit\\n\");\n\n    while (keepRunning) {\n        broadcast(service);\n        sleep1(2);\n    }\n    return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtakland%2Fnative-mdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtakland%2Fnative-mdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtakland%2Fnative-mdns/lists"}