DNScode 1.4.1
Simplifying DNS configuration
Loading...
Searching...
No Matches
dnscode.dnscode.Zone Class Reference

Public Member Functions

 __post_init__ (self)
 
 __str__ (self)
 
 new_A (self, str name='@', int ttl=3600, str host='0.0.0.0')
 
 new_AAAA (self, str name='@', int ttl=3600, str host='fe80::42:2cff:fe29:8db1')
 
 new_CNAME (self, str name='@', int ttl=3600, str host='example.com')
 
 new_MX (self, str name='@', int ttl=3600, int priority=10, str host='example.com')
 
 new_NS (self, str name='@', int ttl=3600, str host='example.com')
 
 new_PTR (self, str name='@', int ttl=3600, str host='example.com')
 
 new_SOA (self, str mname='ns1.example.com', str rname='admin.example.com', int serial=int(time.time()), int refresh=86400, int retry=7200, int expire=15552000, int ttl=21700)
 
 new_SRV (self, str name='@', int ttl=3600, str service='service', str protocol='proto', int priority=10, int weight=10, str host='example.com')
 
 new_record (self, str name='@', int ttl=3600, str rtype='A', str data='0.0.0.0')
 
 add (self, Record record)
 
 save_file (self, str filepath)
 

Public Attributes

str records = str(record) + '\n'
 

Static Public Attributes

str origin = 'example.com'
 
list records = field(default_factory=list)
 

Detailed Description

Represents a DNS zone containing multiple records.

Member Function Documentation

◆ __post_init__()

dnscode.dnscode.Zone.__post_init__ ( self)
Initializes a zone with the given origin and ensures it ends with a dot.

◆ __str__()

dnscode.dnscode.Zone.__str__ ( self)
Returns a string representation of the zone.

◆ add()

dnscode.dnscode.Zone.add ( self,
Record record )
Adds a record to the zone.

◆ new_A()

dnscode.dnscode.Zone.new_A ( self,
str name = '@',
int ttl = 3600,
str host = '0.0.0.0' )
Creates and adds a new A record to the zone.

◆ new_AAAA()

dnscode.dnscode.Zone.new_AAAA ( self,
str name = '@',
int ttl = 3600,
str host = 'fe80::42:2cff:fe29:8db1' )
Creates and adds a new AAAA record to the zone.

◆ new_CNAME()

dnscode.dnscode.Zone.new_CNAME ( self,
str name = '@',
int ttl = 3600,
str host = 'example.com' )
Creates and adds a new CNAME record to the zone.

◆ new_MX()

dnscode.dnscode.Zone.new_MX ( self,
str name = '@',
int ttl = 3600,
int priority = 10,
str host = 'example.com' )
Creates and adds a new MX record to the zone.

◆ new_NS()

dnscode.dnscode.Zone.new_NS ( self,
str name = '@',
int ttl = 3600,
str host = 'example.com' )
Creates and adds a new NS record to the zone.

◆ new_PTR()

dnscode.dnscode.Zone.new_PTR ( self,
str name = '@',
int ttl = 3600,
str host = 'example.com' )
Creates and adds a new PTR record to the zone.

◆ new_record()

dnscode.dnscode.Zone.new_record ( self,
str name = '@',
int ttl = 3600,
str rtype = 'A',
str data = '0.0.0.0' )
Creates and adds a generic DNS record to the zone.

◆ new_SOA()

dnscode.dnscode.Zone.new_SOA ( self,
str mname = 'ns1.example.com',
str rname = 'admin.example.com',
int serial = int(time.time()),
int refresh = 86400,
int retry = 7200,
int expire = 15552000,
int ttl = 21700 )
Creates and adds a new SOA record to the zone.

◆ new_SRV()

dnscode.dnscode.Zone.new_SRV ( self,
str name = '@',
int ttl = 3600,
str service = 'service',
str protocol = 'proto',
int priority = 10,
int weight = 10,
str host = 'example.com' )
Creates and adds a new SRV record to the zone.

◆ save_file()

dnscode.dnscode.Zone.save_file ( self,
str filepath )
Saves the zone records to a file.

Member Data Documentation

◆ origin

str dnscode.dnscode.Zone.origin = 'example.com'
static

◆ records [1/2]

list dnscode.dnscode.Zone.records = field(default_factory=list)
static

◆ records [2/2]

str dnscode.dnscode.Zone.records = str(record) + '\n'

The documentation for this class was generated from the following file: