Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL for ip update #98

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/thenewboston/base_classes/initialize_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/thenewboston/constants/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/thenewboston/models/network_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down