2020-03-02 06:17:04 +00:00
|
|
|
from django.db import models
|
2020-04-03 17:27:49 +00:00
|
|
|
from django.contrib.auth import get_user_model
|
|
|
|
from django.core.validators import MinValueValidator, MaxValueValidator
|
|
|
|
|
|
|
|
|
|
|
|
from uncloud_pay.models import Product, RecurringPeriod
|
|
|
|
from uncloud.models import UncloudModel, UncloudStatus
|
|
|
|
|
2020-04-06 20:30:01 +00:00
|
|
|
|
|
|
|
class MACAdress(models.Model):
|
|
|
|
default_prefix = 0x420000000000
|
|
|
|
|
2020-04-03 17:27:49 +00:00
|
|
|
class VPNPool(UncloudModel):
|
|
|
|
"""
|
|
|
|
Network address pools from which VPNs can be created
|
|
|
|
"""
|
|
|
|
|
2020-04-06 20:30:01 +00:00
|
|
|
network = models.GenericIPAddressField(primary_key=True)
|
2020-04-03 17:27:49 +00:00
|
|
|
|
|
|
|
network_size = models.IntegerField(validators=[MinValueValidator(0),
|
|
|
|
MaxValueValidator(128)])
|
|
|
|
|
2020-04-06 20:30:01 +00:00
|
|
|
vpn_hostname = models.CharField(max_length=256)
|
|
|
|
|
|
|
|
wireguard_private_key = models.CharField(max_length=48)
|
|
|
|
|
|
|
|
|
|
|
|
class VPNNetwork(Product):
|
2020-04-03 17:27:49 +00:00
|
|
|
"""
|
|
|
|
A selected network. Used for tracking reservations / used networks
|
|
|
|
"""
|
|
|
|
vpnpool = models.ForeignKey(VPNPool,
|
|
|
|
on_delete=models.CASCADE)
|
|
|
|
|
2020-04-06 20:30:01 +00:00
|
|
|
network = models.GenericIPAddressField(editable=False,
|
|
|
|
unique=True)
|
2020-03-02 06:17:04 +00:00
|
|
|
|
2020-04-06 20:30:01 +00:00
|
|
|
wireguard_public_key = models.CharField(max_length=48)
|