{"id":13801531,"url":"https://github.com/belyalov/tinydns","last_synced_at":"2025-04-25T23:30:36.863Z","repository":{"id":91675815,"uuid":"130529767","full_name":"belyalov/tinydns","owner":"belyalov","description":"Very simple DNS async server for micropython","archived":false,"fork":false,"pushed_at":"2023-01-05T19:15:36.000Z","size":11,"stargazers_count":32,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-22T12:33:06.132Z","etag":null,"topics":["dns","dns-server","micropython","tinydns"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/belyalov.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}},"created_at":"2018-04-22T02:51:06.000Z","updated_at":"2024-03-25T05:26:04.000Z","dependencies_parsed_at":"2024-01-07T21:53:07.751Z","dependency_job_id":"14386898-5be1-4e3a-8b52-1c26f0eeb69a","html_url":"https://github.com/belyalov/tinydns","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/belyalov%2Ftinydns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belyalov%2Ftinydns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belyalov%2Ftinydns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belyalov%2Ftinydns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belyalov","download_url":"https://codeload.github.com/belyalov/tinydns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250912660,"owners_count":21506865,"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-server","micropython","tinydns"],"created_at":"2024-08-04T00:01:23.940Z","updated_at":"2025-04-25T23:30:36.602Z","avatar_url":"https://github.com/belyalov.png","language":"Python","readme":"## TinyDNS [![Build Status](https://travis-ci.org/belyalov/tinydns.svg?branch=master)](https://travis-ci.org/belyalov/tinydns)\nSimple and lightweight (thus - *tiny*) DNS server for tiny devices like **ESP8266** / **ESP32** running [micropython](https://github.com/micropython/micropython).\nSometimes people needs very simple DNS just to server a few domains.\nFor example - very common use case is **captive portal**\n\n### Features\n* Fully asynchronous using [uasyncio](https://github.com/micropython/micropython-lib/tree/master/uasyncio) library for MicroPython.\n* *Tiny* memory usage. So you can run it on devices like **ESP8266 / ESP32** with 64K/96K of RAM onboard.\n* Great unittest coverage. So you can be confident about quality :)\n\n### Requirements\n* [uasyncio](https://github.com/micropython/micropython-lib/tree/master/uasyncio) - micropython version of *async* library for big brother - python3.\n* [uasyncio-core](https://github.com/micropython/micropython-lib/tree/master/uasyncio.core)\n\n### Quickstart\nTinyDNS comes as a compiled firmware for ESP8266 / ESP32 as well (\"frozen modules\"). You don't have to use it - however, it could be easiest way to try it :)\nInstructions below are tested with *NodeMCU* devices. For your device instructions could be slightly different, so keep in mind.\n**CAUTION**: If you proceed with installation all data on your device will **lost**!\n\n#### Installation - ESP8266\n* Download latest `firmware_esp8266.bin` from [releases](https://github.com/belyalov/tinydns/releases).\n* Install `esp-tool` if you haven't done already: `pip install esptool`\n* Erase flash: `esptool.py --port \u003cUART PORT\u003e --baud 115200 erase_flash`\n* Flash firmware: `esptool.py --port \u003cUART PORT\u003e --baud 115200 write_flash -fm dio 0 firmware_esp8266.bin`\n\n#### Installation - ESP32\n* Download latest `firmware_esp32.bin` from [releases](https://github.com/belyalov/tinydns/releases).\n* Install `esp-tool` if you haven't done already: `pip install esptool`\n* Erase flash: `esptool.py --port \u003cUART PORT\u003e --baud 115200 erase_flash`\n* Flash firmware: `esptool.py --port \u003cUART PORT\u003e --baud 115200 write_flash -fm dio 0x1000 firmware_esp32.bin`\n\n#### Let's code\nComing very soon!\n\n### Limitation / Known issues\n* UDP only\n* IPv4 only (therefore only **A** queries)\n* Simple DNS requests only: 1 DNS query per packet (99% of DNS requests)\n\n### Reference\n#### class `Server`\n* `__init__(self, domains={}, ttl=10, max_pkt_len=512, ignore_unknown=False)` - create `tinydns` server instance.\n    * `domains` - **dict** of domains to resolve - *domain* -\u003e *IPv4*. E.g. `{'my.com': '192.168.1.1', 'yep.com': '127.0.0.1'}`\n    * `ttl` - Response TimeToLive, i.e. how long answer can be stored in the cache.\n    * `max_pkt_len` - Maximum UDP packet length to serve. Due to memory constrained devices it is good to restrict datagram size.\n    * `ignore_unknown` - Controls behavior for *unknown domain* case. If turned on - no error response will be generated.\n\n* `add_domain(self, domain, ip)` - add `domain` to resolved to `ip`. All parameters are `str`.\n\n* `run(self, host='127.0.0.1', port=53)` - run DNS server. Because of *tinydns* is fully async server and assumption here is you're running it as a part of some main application so it **will not** call `loop_forever()`.\n    * `host` - host to listen on\n    * `port` - port to listen on\n\nMore documentation and examples coming soon! :)","funding_links":[],"categories":["Libraries"],"sub_categories":["Communications"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelyalov%2Ftinydns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelyalov%2Ftinydns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelyalov%2Ftinydns/lists"}