{"id":13737061,"url":"https://github.com/rockcavera/nim-ndns","last_synced_at":"2025-07-11T19:01:57.077Z","repository":{"id":170167028,"uuid":"322740707","full_name":"rockcavera/nim-ndns","owner":"rockcavera","description":"A pure Nim Domain Name System (DNS) client","archived":false,"fork":false,"pushed_at":"2024-06-19T17:23:52.000Z","size":90,"stargazers_count":24,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-09T05:46:12.635Z","etag":null,"topics":["client","dns","dns-client","nim","nim-lang","tcp","udp"],"latest_commit_sha":null,"homepage":"https://rockcavera.github.io/nim-ndns/ndns.html","language":"Nim","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/rockcavera.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":"2020-12-19T01:15:53.000Z","updated_at":"2025-05-27T08:45:14.000Z","dependencies_parsed_at":"2024-11-15T05:42:02.367Z","dependency_job_id":null,"html_url":"https://github.com/rockcavera/nim-ndns","commit_stats":null,"previous_names":["rockcavera/nim-ndns"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rockcavera/nim-ndns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-ndns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-ndns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-ndns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-ndns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rockcavera","download_url":"https://codeload.github.com/rockcavera/nim-ndns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-ndns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264878580,"owners_count":23677450,"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":["client","dns","dns-client","nim","nim-lang","tcp","udp"],"created_at":"2024-08-03T03:01:34.416Z","updated_at":"2025-07-11T19:01:57.052Z","avatar_url":"https://github.com/rockcavera.png","language":"Nim","funding_links":[],"categories":["Web"],"sub_categories":["Protocols"],"readme":"A pure Nim Domain Name System (DNS) client implemented with [dnsprotocol](https://github.com/rockcavera/nim-dnsprotocol).\n\nThis implementation has synchronous and asynchronous (async) procedures (procs) for transmitting data over the internet, using both UDP and TCP protocol.\n# Install\n`nimble install ndns`\n\nor\n\n`nimble install https://github.com/rockcavera/nim-ndns.git`\n# Basic Use\nResolving IPv4 addresses for nim-lang.org (**not async**):\n```nim\nimport ndns\n\nlet client = initDnsClient()\n\necho resolveIpv4(client, \"nim-lang.org\")\n```\n\nResolving IPv4 addresses for nim-lang.org (**async**):\n```nim\nimport asyncdispatch, ndns\n\nlet client = initDnsClient()\n\necho waitFor asyncResolveIpv4(client, \"nim-lang.org\")\n```\n\nFor a \"real-life\" async example, see [resolver.nim](/examples/resolver.nim). In this example I have made as many comments as possible, even if they look silly. I think it might help someone, as a similar example I provided privately for a newcomer to Nim. It can also be compiled with `-d:showLoopLog` to show the async workflow.\n# Advanced Use\nCreating a `Message` object with a `QType.A` query for the domain name nim-lang.org, transmitting the `Message` and receiving the response (**not async**):\n```nim\nimport ndns\n\nlet header = initHeader(randId(), rd = true)\n\nlet question = initQuestion(\"nim-lang.org\", QType.A, QClass.IN)\n  # If the last character of \"nim-lang.org\" is not a '.', the initializer will\n  # add, as it is called the DNS root.\n\nlet msg = initMessage(header, @[question])\n  # The initializer automatically changes `header.qdcount` to `1'u16`\n\nlet client = initDnsClient()\n\nvar rmsg = dnsQuery(client, msg)\n\necho repr(rmsg)\n```\n\nCreating a `Message` object with a `QType.A` query for the domain name nim-lang.org, transmitting the `Message` and receiving the response (**async**):\n```nim\nimport asyncdispatch, ndns\n\nlet header = initHeader(randId(), rd = true)\n\nlet question = initQuestion(\"nim-lang.org\", QType.A, QClass.IN)\n  # If the last character of \"nim-lang.org\" is not a '.', the initializer will\n  # add, as it is called the DNS root.\n\nlet msg = initMessage(header, @[question])\n  # The initializer automatically changes `header.qdcount` to `1'u16`\n\nlet client = initDnsClient()\n\nvar rmsg = waitFor dnsAsyncQuery(client, msg)\n\necho repr(rmsg)\n```\n# Using System DNS Server\nYou can initialize the DNS client with the DNS resolver server used by the system. To do this, start the client with `initSystemDnsClient`.\n```nim\nimport ndns\n\nlet client = initSystemDnsClient()\n\necho resolveIpv4(client, \"nim-lang.org\")\n```\n# Documentation\nhttps://rockcavera.github.io/nim-ndns/ndns.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-ndns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frockcavera%2Fnim-ndns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-ndns/lists"}