{"id":13737066,"url":"https://github.com/rockcavera/nim-dnsprotocol","last_synced_at":"2025-07-11T19:01:57.115Z","repository":{"id":48993211,"uuid":"322730994","full_name":"rockcavera/nim-dnsprotocol","owner":"rockcavera","description":"Domain Name System (DNS) protocol for Nim programming language","archived":false,"fork":false,"pushed_at":"2025-02-06T22:35:03.000Z","size":164,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-09T05:46:12.308Z","etag":null,"topics":["dns","dns-protocol","nim","nim-lang","protocol"],"latest_commit_sha":null,"homepage":"https://rockcavera.github.io/nim-dnsprotocol/dnsprotocol.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,"zenodo":null}},"created_at":"2020-12-19T00:00:32.000Z","updated_at":"2025-02-06T22:33:29.000Z","dependencies_parsed_at":"2024-01-06T12:03:06.281Z","dependency_job_id":"f9f13cea-e95e-4896-86cf-92d0ffac66ba","html_url":"https://github.com/rockcavera/nim-dnsprotocol","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rockcavera/nim-dnsprotocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-dnsprotocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-dnsprotocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-dnsprotocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-dnsprotocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rockcavera","download_url":"https://codeload.github.com/rockcavera/nim-dnsprotocol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-dnsprotocol/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":["dns","dns-protocol","nim","nim-lang","protocol"],"created_at":"2024-08-03T03:01:34.504Z","updated_at":"2025-07-11T19:01:56.954Z","avatar_url":"https://github.com/rockcavera.png","language":"Nim","funding_links":[],"categories":["Web"],"sub_categories":["Protocols"],"readme":"Domain Name System (DNS) protocol for Nim programming language\n\nThe current implementation was based on RFCs [1034](https://tools.ietf.org/html/rfc1034) and [1035](https://tools.ietf.org/html/rfc1035). There is still much to be done...\n\nThis package does not transport data, that is, it is neither a DNS client nor a DNS server, but it can be used to implement them. If you need a client dns use [ndns](https://github.com/rockcavera/nim-ndns).\n# Current Support\nMost types of the IN class are currently supported. However, if I need to add a type, I would be happy to receive a PR and a little less with an issue.\n\nFor dns types, classes, rcodes, etc. that are supported, access [here](https://rockcavera.github.io/nim-dnsprotocol/dnsprotocol/types.html). Unsupported types are stored in `RDataUnknown`, thus avoiding runtime errors.\n# Install\n`nimble install dnsprotocol`\n\nor\n\n`nimble install https://github.com/rockcavera/nim-dnsprotocol.git`\n# Basic Use\nCreating a `Message` object with a `QType.A` query for the domain name nim-lang.org:\n```nim\nimport dnsprotocol\n\nlet header = initHeader(id = 12345'u16, 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\necho msg\n\nlet bmsg = toBinMsg(msg)\n\necho \"\\n\", bmsg\n```\n\nCreating a `Message` object with the query response from the previous example:\n```nim\nimport dnsprotocol\n\nlet header = initHeader(id = 12345'u16, qr = QR.Response, rd = true, ra = true)\n\nlet question = initQuestion(\"nim-lang.org.\", QType.A, QClass.IN)\n\nlet rr1 = initResourceRecord(\"nim-lang.org\", Type.A, Class.IN, 299'i32, 4'u16,\n                             RDataA(address: [172'u8, 67, 132, 242]))\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 rr2 = initResourceRecord(\"nim-lang.org.\", Type.A, Class.IN, 299'i32, 4'u16,\n                             RDataA(address: [104'u8, 28, 19, 79]))\n  # The `rdlength` parameter does not need a value, as the `toBinMsg()` does not\n  # use it. The `toBinMsg()` takes the binary size of `rdata` and writes it to\n  # the binary DNS message.\n\nlet rr3 = initResourceRecord(\"nim-lang.org.\", Type.A, Class.IN, 299'i32, 4'u16,\n                             RDataA(address: [104'u8, 28, 18, 79]))\n\nlet msg = initMessage(header, @[question], @[rr1, rr2, rr3])\n  # The initializer automatically changes: `header.qdcount` to `1'u16` and\n  # `header.ancount` to `3'u16`.\n\necho repr(msg) # repr() to show RDatas (RDataA)\n\nlet bmsg = toBinMsg(msg)\n\necho \"\\n\", bmsg\n```\n# Documentation\nhttps://rockcavera.github.io/nim-dnsprotocol/theindex.html\n# Project Layout\nThe project currently has 6 Nim code files.\n\n`dnsprotocol.nim` contains object initializers; the builders of binary DNS messages; and the binary DNS message parsers. **It is the only file that must be imported into your project**.\n\n`dnsprotocol/rdatas.nim` does all the \"magic\" of transforming RDatas (specific objects for each type and class) into binary DNS messages and the reverse way too, that is, it transforms binary DNS messages into RDatas. **It should never be imported directly into your project**.\n\n`dnsprotocol/rdatatypes.nim` is where all types of RDatas are declared. **It should never be imported directly into your project**.\n\n`dnsprotocol/streams2.nim` provides some stream procedures, for reading and writing, making the conversion, if necessary, between endians (order of bytes). **It should never be imported directly into your project**.\n\n`dnsprotocol/types.nim` is where all types, enumerators and objects of the project are declared. **It should never be imported directly into your project**.\n\n`dnsprotocol/utils.nim` has some procedures to build binary DNS messages and binary DNS message parsers, which could not be in other files due to the impossibility of cyclic import in Nim. **It should never be imported directly into your project**.\n\nThe layout of the project has changed several times since I started and can continue to change, if necessary. If you have a suggestion, please send it to me, as I would be grateful to discuss improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-dnsprotocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frockcavera%2Fnim-dnsprotocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-dnsprotocol/lists"}