Giter Club home page Giter Club logo

pdnsapp's Introduction

Deprecation notice

The project is deprecated now and this repo has been archived. I moved to CoreDNS which is not only waaay faster, but covers all features pdnsapp had. Ok.. well, almost all. I had to develop some extra coredns plugins to port some niche features anyone would have barely needed on the long run.


pdnsapp

This is a python microframework to help develop DNS-based applications, very much like bottle.py for HTML or lamsonproject for SMTP. It's 'application server' is PowerDNS.

Examples

1. example: myip

The following code will resond with the IP-address of the querying client for myip.end.re:

@match(fqdn='myip.end.re',type='A')
def myip(request):
    return A(data=request['remote-ip'])

2. example: catch-all

Be authoritative for all the zones. It's like wildcards on steroids. Or like PowerDNS superslave being a supermaster instead.

@match(type='SOA')
def catchall(request):
    return SOA("ns0.end.re dnsadm2.end.re %s 10800 3600 604800 3600" % strftime("%Y%m%d%H"))

@match(type='NS')
def catchall(request):
    return [
        NS('ns0.end.re'),
        NS('ns1.end.re'),
    ]   

3. example: geoip

Simple geoip implementation, this one returns differenct IP address for mx0.end.re depending on the client IP address.

from radix import Radix
rtree = Radix()

for subnet in ['192.168.0.0/24', '192.168.1.0/24']:
    rtree.add(subnet)

@match(type='A', fqdn='mx0.end.re')
def geoip(request):
    if rtree.search_best(request['remote-ip']): #if requesting client is in the prefixes listed
        return A('192.168.1.1')
    else:
        return A('44.128.1.1')

4. example: dynamic reverse records

This is for generating reverse (PTR) DNS entries and their forward (A/AAAA) lookup.

pdnsapp's People

Contributors

endreszabo avatar

Stargazers

Misha Komarovskiy avatar

Watchers

 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.