diff --git a/src/thenewboston/base_classes/initialize_node.py b/src/thenewboston/base_classes/initialize_node.py index 662df36..51e1ba8 100644 --- a/src/thenewboston/base_classes/initialize_node.py +++ b/src/thenewboston/base_classes/initialize_node.py @@ -2,9 +2,9 @@ from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand, CommandParser -from django.core.validators import validate_ipv46_address +from django.core.validators import URLValidator -from thenewboston.argparser.validators import int_validator, ipv46_validator, str_length_validator +from thenewboston.argparser.validators import int_validator, ipv46_validator, str_length_validator, url_validator from thenewboston.constants.network import PROTOCOL_LIST, VERIFY_KEY_LENGTH """ @@ -75,16 +75,17 @@ def get_ip_address(self, value=None): if self.unattended: ip_address = value else: - ip_address = input('Enter public IP address (required): ') + ip_address = input('Enter URL or public IP address (required): ') if not ip_address: self._error('ip_address required') continue try: - validate_ipv46_address(ip_address) + url_validator = URLValidator + url_validator(ip_address) except ValidationError: - self._error('Enter a valid IPv4 or IPv6 address') + self._error('Enter a valid Url, IPv4 or IPv6 address') continue self.required_input['ip_address'] = ip_address diff --git a/src/thenewboston/constants/network.py b/src/thenewboston/constants/network.py index c9bf6bd..f7c6ec5 100644 --- a/src/thenewboston/constants/network.py +++ b/src/thenewboston/constants/network.py @@ -19,7 +19,7 @@ SIGNATURE_LENGTH = 128 VERIFY_KEY_LENGTH = 64 -MEMO_MAX_LENGTH = 64 +MEMO_MAX_LENGTH = 256 MIN_POINT_VALUE = 1 MAX_POINT_VALUE = 281474976710656 diff --git a/src/thenewboston/models/network_node.py b/src/thenewboston/models/network_node.py index a1f2d48..3e93533 100644 --- a/src/thenewboston/models/network_node.py +++ b/src/thenewboston/models/network_node.py @@ -9,7 +9,7 @@ class NetworkNode(models.Model): id = models.UUIDField(default=uuid4, editable=False, primary_key=True) # noqa: A003 account_number = models.CharField(max_length=VERIFY_KEY_LENGTH) - ip_address = models.GenericIPAddressField() + ip_address = models.URLField() node_identifier = models.CharField(max_length=VERIFY_KEY_LENGTH, unique=True) port = models.PositiveIntegerField(blank=True, null=True, validators=[MaxValueValidator(65535)]) protocol = models.CharField(choices=PROTOCOL_CHOICES, max_length=5)