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

Added ipv6 scoped architecture text format #1160

Merged
merged 3 commits into from
Nov 11, 2019

Conversation

anjoshigor
Copy link
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 🤘

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

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
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