Giter Club home page Giter Club logo

microdnssrv's Introduction

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 👍

microdnssrv's People

Contributors

jczic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.