It's a micro DNS server library for MicroPython.It adopts the programming style of DNSServer library in ESP Arduino Core.
Just upload DNSServer.py to your ESP board and you're done.
To use DNSServer.py library, you should:
-
From DNSServer library import
DNSServer
class. -
Call a
DNSServer
class. -
By calling
start()
to start the server and assign the ip address to correspoding domain name. -
Call
processNextRequest()
repeatly to process requests.
- Start the server at specified port.
- Assign the ip address to correspoding domain name by setting
domain_name
、resolvedIP
para. domain_name
、resolvedIP
para can be string if you only need one paired, otherwise they should be string list.- If you need to redirect all domain name to one ip address, set
domain_name
as'*'
.
- Check for new request and pass the corresponding ip address to client.
- Stop the DNS server.
- You can set the ttl by change this attribute.
- You can set the Rcode by change this attribute.
- From DNSServer library import
DNSReplyCode
class and you can get all Rcode.