This commit is contained in:
Sebastian Lohff 2017-02-21 20:45:44 +01:00
parent cb878d3ed8
commit d49a3c2774
3 changed files with 116 additions and 25 deletions

35
whoisdb/LAYOUT Normal file
View File

@ -0,0 +1,35 @@
All Objects
handle / some type of auto generated identifier
generated from primary object names
can be defined by user
FOO23-(objectname)?
created / last modified
can be auto, at least for add
MNT - Maintainer; Access control for Objects in Database
PERSON/ROLE - Contact; Person or Role data, provides contact data
ASNUM - AS-Number (MNTd); Holds an AS Number
validators: in darknet ranges?
number, unique
mnt_by
lower_mnt_by (can change everything except for as number)
volatile, bool, check if as is not online 24/7
INET(6)NUM - IPv4/IPv6 prefix
address
netmask (cidr)
----- LIR PART
ASBlock
asno start
asno end
IPRange
range start
range end

View File

@ -3,16 +3,9 @@ from django.db import models
from dncore.models import User
from .validators import HandleValidator
class ExtraFields(models.Model):
name = models.CharField(max_length=64)
value = models.CharField(max_length=128)
order = models.PositiveSmallIntegerField()
class WhoisObject(models.Model):
handle_suffix = None
whois_fields = None
whois_extra_field_names = None
handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()])
created = models.DateTimeField(auto_add_now=True)
@ -38,30 +31,26 @@ class Contact(MntdObject):
name = models.CharField(max_length=128)
class MntdCObject(MntdObject)
admin_c = models.ManyToManyField("Contact")
class ASBlock(MntdObject):
parent_block = models.ForeignKey("ASBlock", models.CASCADE, null=True, blank=True, default=None)
description = models.CharField(max_length=64, blank=True)
class Meta:
abstract = True
class MntdObject(WhoisObject):
admin_c = models.ManyToManyField(Contact)
mnt_by = models
class Meta:
abstract = True
class ASNumber(WhoisObject):
class ASNumber(MntdObject):
number = models.PositiveIntegerField(unique=True, db_index=True)
volatile = models.BooleanField(default=False)
asblock = models.ForeignKey(ASBlock, models.CASCADE)
description = models.CharField(max_length=64, blank=True)
mnt_lower = models.ManyToManyField(Maintainer)
#class Route(MntObject):
#
class InetNum(WhoisObject):
PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6'))
protocol = models.CharField(max_length=4, choices=PROTO)
netmask = models.PositiveIntegerField()
parent_range = models.ForeignKey("InetNum", models.CASCADE, null=True, blank=True, default=None)
description = models.CharField(max_length=64, blank=True)
#class ASBlock(WhoisObject):
# pass
mnt_lower = models.ManyToManyField(Maintainer)

67
whoisdb/models_crap.py Normal file
View File

@ -0,0 +1,67 @@
from django.db import models
from dncore.models import User
from .validators import HandleValidator
class ExtraFields(models.Model):
name = models.CharField(max_length=64)
value = models.CharField(max_length=128)
order = models.PositiveSmallIntegerField()
class WhoisObject(models.Model):
handle_suffix = None
whois_fields = None
whois_extra_field_names = None
handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()])
created = models.DateTimeField(auto_add_now=True)
last_modified = models.DateTimeField(auto_add_now=True)
class Meta:
abstract = True
class Maintainer(WhoisObject):
auth = models.ManyToManyField(User)
admin_c = models.ManyToManyField("Contact")
class MntdObject(WhoisObject):
mnt_by = models.ManyToManyField(Maintainer)
class Meta:
abstract = True
class Contact(MntdObject):
TYPE = (('person', 'person'), ('role', 'role'))
name = models.CharField(max_length=128)
class MntdCObject(MntdObject)
admin_c = models.ManyToManyField("Contact")
class Meta:
abstract = True
class MntdObject(WhoisObject):
admin_c = models.ManyToManyField(Contact)
mnt_by = models
class Meta:
abstract = True
class ASNumber(WhoisObject):
number = models.PositiveIntegerField(unique=True, db_index=True)
class InetNum(WhoisObject):
PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6'))
protocol = models.CharField(max_length=4, choices=PROTO)
netmask = models.PositiveIntegerField()
#class ASBlock(WhoisObject):
# pass