Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions RiiConnect24-DNS-Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ def get_platform():
'darwin' : 'OS X',
'win32' : 'Windows'
}
if sys.platform not in platforms:
return sys.platform

return platforms[sys.platform]
return platforms.get(sys.platform, sys.platform)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_platform refactored with the following changes:


RIICONNECT24DNSSERVER_VERSION = "1.2"

Expand All @@ -49,7 +46,7 @@ def get_ip():

print("+===============================+")
print("| RiiConnect24 DNS Server |")
print("| Version " + RIICONNECT24DNSSERVER_VERSION + " |")
print(f"| Version {RIICONNECT24DNSSERVER_VERSION} |")
Comment on lines -52 to +49
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 52-52 refactored with the following changes:

print("+===============================+\n")

print("Hello! This server will allow you to connect to RiiConnect24 when your Internet Service Provider does not work with custom DNS.")
Expand Down Expand Up @@ -132,24 +129,21 @@ def __init__(self, rdata_type, *args, rtype=None, rname=None, ttl=None, **kwargs
)

def try_rr(self, q):
if q.qtype == QTYPE.ANY or q.qtype == self._rtype:
if q.qtype in [QTYPE.ANY, self._rtype]:
Comment on lines -135 to +132
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Record.try_rr refactored with the following changes:

return self.as_rr(q.qname)

def as_rr(self, alt_rname):
return RR(rname=self._rname or alt_rname, rtype=self._rtype, **self.kwargs)

def sensible_ttl(self):
if self._rtype in (QTYPE.NS, QTYPE.SOA):
return 60 * 60 * 24
else:
return 300
return 60 * 60 * 24 if self._rtype in (QTYPE.NS, QTYPE.SOA) else 300
Comment on lines -142 to +139
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Record.sensible_ttl refactored with the following changes:


@property
def is_soa(self):
return self._rtype == QTYPE.SOA

def __str__(self):
return '{} {}'.format(QTYPE[self._rtype], self.kwargs)
return f'{QTYPE[self._rtype]} {self.kwargs}'
Comment on lines -152 to +146
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Record.__str__ refactored with the following changes:



ZONES = {}
Expand Down