Skip to content

Conversation

@antongolub
Copy link
Member

@antongolub antongolub commented Oct 10, 2025

Adds compat mode for embedded IPv4 in IPv6.

import { Address } from '@webpod/ip'

Address.from('::ffff:5.6.7.8')    // ok
Address.from('1:2:3:4::5.6.7.8')  // throws

Address.strict = false
Address.from('1:2:3:4::5.6.7.8')  // now it's fine

Relates

@antongolub antongolub added enhancement New feature or request test QA & tests improvements labels Oct 10, 2025
@antongolub antongolub merged commit b12df5c into main Oct 10, 2025
21 checks passed
@antongolub antongolub deleted the strict-switch branch October 10, 2025 20:58
@antongolub
Copy link
Member Author

antongolub commented Oct 10, 2025

@richb-hanover

Fyi, your tests came in handy here. The original suite has been slightly modified, but all information about the authors, licenses, and links to the source have been preserved.

@richb-hanover
Copy link
Contributor

Oh, wow! I am flattered. My one request would be to include a little more information about the provenance of the test cases, something like this:

/**
 * These test cases were borrowed and slightly adapted from richb-intermapper/IPv6-Regex.
 * All credit goes to Rich Brown, Dartware, intermapper.com.
 *
 * Provenance of the test cases: The original document at:
 * https://github.com/richb-intermapper/IPv6-Regex/blob/master/test-ipv6-regex.pl
 * collected test cases from various sources around the internet.
 *
 * THERE ARE DEFINITELY DUPLICATE TESTS. They don't matter if the test
 * function works, they take a millisecond (or less) to check.
 * 
 * Please submit updated tests cases as an Issue to this repository.
 * 
 * Original license:
 *
 * IPv6 Regex by Dartware, LLC is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
 * To attribute this work, place a link to http://intermapper.com in the Credits or About... window of your software.
 * We would love to have you send any changes to the code or regular expression back to us at support@intermapper.com.
 */

(I also broke some long lines to be shorter. This makes it easier to read a diff, should that ever be necessary.)

Another thought: Dartware was purchased by Fortra (I was CEO until the acquisition.) I doubt that Fortra (support@intermapper.com) is interested in updating the original document (or that they even know about it.) So I added the item about updating THIS repo with any new test cases.

Thanks again!

@richb-hanover richb-hanover mentioned this pull request Oct 11, 2025
antongolub pushed a commit that referenced this pull request Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test QA & tests improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants