-
-
Notifications
You must be signed in to change notification settings - Fork 943
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
feat(internet): Add RFC 5737 testing IPv4 support #2460
Conversation
9647623
to
f774023
Compare
f774023
to
1e4f57d
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #2460 +/- ##
=======================================
Coverage 99.58% 99.58%
=======================================
Files 2823 2823
Lines 255497 255518 +21
Branches 1102 1103 +1
=======================================
+ Hits 254434 254458 +24
+ Misses 1035 1032 -3
Partials 28 28
|
Please don't do that with ANY data generated by Faker (emails, phone numbers, etc). This should include IP addresses as well. Lines 46 to 48 in 350dfbf
|
Totally fine for this to be closed if you think it's unnecessary with that guidance in the readme |
Team Proposal How about the following api? ipv4(options: {ipRange: LiteralUnion<'TEST-NET-1' | 'TEST-NET-2' | 'TEST-NET-3'>}) {
let { ipRange } = options;
if (ipRange != null) {
if (ipRange === 'TEST-NET-1')
ipRange = '192.0.2.0/24'
...
const [ipBase, mask] = ipRange.split('/');
const maskInt = +mask;
const maskBit = 2 ** mask -1;
const ipBaseInt = ipToInt32(ipBase) & ^maskBit;
const ipSuffix = faker.number.int(maskBit);
return toIpv4(ipBaseInt + ipSuffix)
} else {
// current impl
}
} |
@thomas-phillips-nz What do you think of our proposal? |
Superseded by #2992 Thanks for suggesting this feature. |
Adds support for generating random testing-safe IPv4 addresses according to RFC 5737
Sometimes you need to generate an IP address but don't want the system being tested to try and resolve or send traffic to the IP
I guess this could be added as an option to the existing ipv4() function?