Skip to content

A micro DNS server for MicroPython to simply respond to A queries on multi-domains with or without wildcards (used on Pycom modules & ESP32)

License

Notifications You must be signed in to change notification settings

zyl1121/MicroDNSSrv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroDNSSrv is a micro DNS server for MicroPython to simply respond to A queries (principally used on ESP32 and Pycom modules)

HC²

Very easy to integrate and very light with one file only :

  • "microDNSSrv.py"

Simple but effective :

  • Use it to embed a fast DNS server in yours modules
  • Simply responds to A queries (only)
  • Use a list of multiple domains
  • Include wildcards in the scheme of names
  • Use it to make a captive portal simply

Using microDNSSrv main class :

Name Function
Constructor mds = MicroDNSSrv()
Start DNS server mds.Start()
Stop DNS server mds.Stop()
Check if DNS server is running mds.IsStarted()
Set the domain names list mds.SetDomainsList(domainsList)

Basic example :

from microDNSSrv import MicroDNSSrv
domainsList = {
  "test.com"   : "1.1.1.1",
  "*test2.com" : "2.2.2.2",
  "*google*"   : "192.168.4.1",
  "*.toto.com" : "192.168.4.1",
  "www.site.*" : "192.168.4.1" }
mds = MicroDNSSrv(domainsList)
if mds.Start() :
  print("MicroDNSSrv started.")
else :
  print("Error to starts MicroDNSSrv...")

Using microDNSSrv speedly creation of the class :

from microDNSSrv import MicroDNSSrv
if MicroDNSSrv.Create( {
  "test.com"   : "1.1.1.1",
  "*test2.com" : "2.2.2.2",
  "*google*"   : "192.168.4.1",
  "*.toto.com" : "192.168.4.1",
  "www.site.*" : "192.168.4.1" } ) :
  print("MicroDNSSrv started.")
else :
  print("Error to starts MicroDNSSrv...")

Using for a captive portal :

MicroDNSSrv.Create({ '*' : '192.168.0.254' })

By JC`zic for HC² ;')

Keep it simple, stupid 👍

About

A micro DNS server for MicroPython to simply respond to A queries on multi-domains with or without wildcards (used on Pycom modules & ESP32)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%