Skip to content

Added ipv6 scoped architecture text format#1160

Merged
profnandaa merged 3 commits into
validatorjs:masterfrom
anjoshigor:ipv6-zone
Nov 11, 2019
Merged

Added ipv6 scoped architecture text format#1160
profnandaa merged 3 commits into
validatorjs:masterfrom
anjoshigor:ipv6-zone

Conversation

@anjoshigor

Copy link
Copy Markdown
Contributor

This PR aims to resolve #972.

As stated by RFC 4007:

a common notation to specify the scope zone, an implementation SHOULD
support the following format:
            <address>%<zone_id>
 where
      <address> is a literal IPv6 address,
      <zone_id> is a string identifying the zone of the address, and
      `%' is a delimiter character to distinguish between <address> and
      <zone_id>.

These are some examples:

fe80::1234%1
ff02::5678%5
ff08::9abc%10
fe80::1234%ne0
ff02::5678%pvc1.3
ff08::9abc%interface10

Due to that, I modified isIP.js to behave accordingly when a % character is found. Tests were also enhanced to fulfill this new requirement.

Please, any doubt contact me 🤘

Comment thread src/lib/isIP.js Outdated
Comment on lines +66 to +67
const address = addressAndZone[0];
const blocks = address.split(':');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const blocks = addressAndZone[0].split(':');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixed it! :)

@profnandaa profnandaa merged commit 4dc1f88 into validatorjs:master Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isIP() rejects scoped IPv6 address

4 participants