fix(internet): exclude reserved port 0 from internet.port()#3948
fix(internet): exclude reserved port 0 from internet.port()#3948xianjianlf2 wants to merge 2 commits into
Conversation
…#3937) Port 0 is reserved per RFC 6335 and must not be assigned as a usable port, so internet.port() now returns a value in [1, 65535].
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
As by comment #3937 (comment) we are currently not sure how to handle this. Since port |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3948 +/- ##
=======================================
Coverage 98.84% 98.84%
=======================================
Files 923 923
Lines 3216 3216
Branches 583 583
=======================================
Hits 3179 3179
Misses 33 33
Partials 4 4
🚀 New features to boost your workflow:
|
|
@xianjianlf2 Can you comment your thoughts on the linked issues? |
|
Replied on the linked issue with my thoughts on bug-vs-feature classification and the reserved-port scope: #3937 (comment) Short version: I've retracted the inaccurate "must not appear on the wire" wording (updated both descriptions) — the authoritative basis is simply that IANA lists port |
Closes #3937
faker.internet.port()callsthis.faker.number.int(65535), whose range is inclusive of0. Port0is listed asReservedby IANA (RFC 6335 §6) and is never a usable service port, so seeded values fed into a real socket (net.connect({ port: 0 })) trigger OS-assigned ephemeral behavior instead of the seeded value.This restricts the range to
1..65535:toBeGreaterThanOrEqual(0)→1).internet > 42 > port); no other snapshots changed.pnpm exec vitest run test/modules/internet.spec.ts→ 1125 passed, no type errors.