Make better use of subclassing features.
This commit is contained in:
parent
73bcbc02d4
commit
151f504b83
1 changed files with 2 additions and 2 deletions
4
main.py
4
main.py
|
@ -19,6 +19,8 @@ class Record:
|
||||||
data: str = '0.0.0.0'
|
data: str = '0.0.0.0'
|
||||||
ttl: int = 6400
|
ttl: int = 6400
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class SOA(Record):
|
class SOA(Record):
|
||||||
def __init__(self, mname: str = 'ns1.example.com', rname: str = 'admin.example.com', serial: int = int(time.time()), refresh: int = 86400, retry: int = 7200, expire: int = 15552000, ttl: int = 21700):
|
def __init__(self, mname: str = 'ns1.example.com', rname: str = 'admin.example.com', serial: int = int(time.time()), refresh: int = 86400, retry: int = 7200, expire: int = 15552000, ttl: int = 21700):
|
||||||
|
@ -33,8 +35,6 @@ class SOA(Record):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(Record(self.name, self.ttl, f'{self.mname} {self.rname} {self.serial} {self.refresh} {self.retry} {self.expire} {self.ttl}'))
|
return str(Record(self.name, self.ttl, f'{self.mname} {self.rname} {self.serial} {self.refresh} {self.retry} {self.expire} {self.ttl}'))
|
||||||
|
|
||||||
name: str = '@'
|
|
||||||
rtype: str = 'SOA'
|
|
||||||
mname: str = 'ns1.example.com'
|
mname: str = 'ns1.example.com'
|
||||||
rname: str = 'admin.example.com'
|
rname: str = 'admin.example.com'
|
||||||
serial: int = int(time.time())
|
serial: int = int(time.time())
|
||||||
|
|
Loading…
Add table
Reference in a new issue