update to work on different computer
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
913e992a48
commit
938f0a3390
7 changed files with 139 additions and 88 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import uuid
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
|
|
@ -15,24 +17,36 @@ class VPNPool(UncloudModel):
|
|||
Network address pools from which VPNs can be created
|
||||
"""
|
||||
|
||||
network = models.GenericIPAddressField(primary_key=True)
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
|
||||
network = models.GenericIPAddressField(unique=True)
|
||||
network_size = models.IntegerField(validators=[MinValueValidator(0),
|
||||
MaxValueValidator(128)])
|
||||
|
||||
subnetwork_size = models.IntegerField(validators=[MinValueValidator(0),
|
||||
MaxValueValidator(128)])
|
||||
|
||||
vpn_hostname = models.CharField(max_length=256)
|
||||
|
||||
wireguard_private_key = models.CharField(max_length=48)
|
||||
|
||||
|
||||
class VPNNetwork(Product):
|
||||
class VPNNetworkReservation(UncloudModel):
|
||||
"""
|
||||
A selected network. Used for tracking reservations / used networks
|
||||
This class tracks the used VPN networks. It will be deleted, when the product is cancelled.
|
||||
"""
|
||||
vpnpool = models.ForeignKey(VPNPool,
|
||||
on_delete=models.CASCADE)
|
||||
|
||||
network = models.GenericIPAddressField(editable=False,
|
||||
unique=True)
|
||||
address = models.GenericIPAddressField(primary_key=True)
|
||||
|
||||
|
||||
class VPNNetwork(Product):
|
||||
"""
|
||||
A selected network. Used for tracking reservations / used networks
|
||||
"""
|
||||
network = models.ForeignKey(VPNNetworkReservation,
|
||||
on_delete=models.CASCADE,
|
||||
editable=False)
|
||||
|
||||
wireguard_public_key = models.CharField(max_length=48)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue