Skip to content

Commit

Permalink
Add packet parsing and error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
yasasa committed Sep 27, 2019
1 parent 914c03f commit 5fe9c76
Show file tree
Hide file tree
Showing 7 changed files with 462 additions and 180 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
__pycache__
.vscode
177 changes: 0 additions & 177 deletions dns.py

This file was deleted.

3 changes: 3 additions & 0 deletions dns/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from dns.resolver import Resolver
from dns.message import Query, Response, QUERY_TYPE_A, QUERY_TYPE_MX, QUERY_TYPE_NS
from dns.errors import *
28 changes: 28 additions & 0 deletions dns/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class DNSError(Exception):
def __init__(self, payload, message=""):
self.payload = payload
self.message = message


class FormatError(DNSError):
pass


class ServerError(DNSError):
pass


class InvalidNameError(DNSError):
pass


class ServerRefusedError(DNSError):
pass


class ResponsePacketError(DNSError):
pass


class ResponseTruncatedError(DNSError):
pass
Loading

0 comments on commit 5fe9c76

Please sign in to comment.