Skip to content

Support host (IP address) in parseSeedNodes #324

@joshuakarp

Description

@joshuakarp

Specification

parseSeedNodes currently assumes that the provided address of the seed node is a hostname, and does not provide support for a seed node with an IP address as a host address:

// src/bin/utils/parsers.ts - parseSeedNodes()
if (!networkUtils.isHostname(idHostPort[1])) {
  throw new commander.InvalidOptionArgumentError(
    `${idHostPort[1]} is not a valid hostname`,
  );
}

Furthermore, it should also provide support for IPv6 addresses - as such, we can no longer rely on a colon/semi-colon split usage. It's been suggested to use new URL to construct a URL from the nodeId@host:port format (will require a prepended pk:// 'protocol') such that we can acquire the different components of the seed nodes.

Additional context

Tasks

  1. Utilise new URL to generate the nodeId@host:port
  2. Include the appropriate exception handling for invalid formats
    • can we specify the particular component of the nodeId@host:port that's invalid if an exception is raised (it's currently done this way through the use of split)? Look into this.
  3. Move function to validation utils
  4. Add test for IP address in seed node

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions