-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
158 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
future | ||
git+https://github.com/oldium/pysimplesoap.git@fix-typeerror#egg=PySimpleSOAP | ||
configargparse | ||
dnslib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
''' | ||
Subreg.cz API simulator suitable for Python lexicon module. | ||
''' | ||
|
||
from __future__ import (absolute_import, print_function) | ||
import logging | ||
import dnslib.server | ||
import dnslib.zoneresolver | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
class ApiDnsResolver(dnslib.server.BaseResolver): | ||
def __init__(self, api): | ||
dnslib.server.BaseResolver.__init__(self) | ||
self.api = api | ||
|
||
def resolve(self, request, handler): | ||
resolver = dnslib.zoneresolver.ZoneResolver(self.api.toZone(), True) | ||
return resolver.resolve(request, handler) | ||
|
||
class ApiDns(dnslib.server.DNSServer): | ||
def __init__(self, resolver, address, port, tcp=False): | ||
dnslib.server.DNSServer.__init__(self, resolver, address, port, tcp) |