pixivflow 2.16.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/version.js +1 -1
- package/dist/webui/package.json +1 -1
- package/node_modules/@redtidev/pixiv-client/LICENSE +21 -0
- package/node_modules/@redtidev/pixiv-client/README.md +103 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.d.ts +6 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.js +14 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.d.ts +30 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.js +137 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/media.d.ts +16 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/media.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/media.js +25 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/media.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.d.ts +43 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.js +250 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/options.d.ts +42 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/options.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/options.js +7 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/options.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.d.ts +9 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.js +22 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/users.d.ts +17 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/users.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/users.js +23 -0
- package/node_modules/@redtidev/pixiv-client/dist/app-api/users.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/auth/types.d.ts +25 -0
- package/node_modules/@redtidev/pixiv-client/dist/auth/types.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/auth/types.js +24 -0
- package/node_modules/@redtidev/pixiv-client/dist/auth/types.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/client.d.ts +42 -0
- package/node_modules/@redtidev/pixiv-client/dist/client.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/client.js +86 -0
- package/node_modules/@redtidev/pixiv-client/dist/client.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/errors/errors.d.ts +117 -0
- package/node_modules/@redtidev/pixiv-client/dist/errors/errors.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/errors/errors.js +169 -0
- package/node_modules/@redtidev/pixiv-client/dist/errors/errors.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/index.d.ts +25 -0
- package/node_modules/@redtidev/pixiv-client/dist/index.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/index.js +50 -0
- package/node_modules/@redtidev/pixiv-client/dist/index.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/logger.d.ts +13 -0
- package/node_modules/@redtidev/pixiv-client/dist/logger.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/logger.js +10 -0
- package/node_modules/@redtidev/pixiv-client/dist/logger.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/models/index.d.ts +112 -0
- package/node_modules/@redtidev/pixiv-client/dist/models/index.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/models/index.js +8 -0
- package/node_modules/@redtidev/pixiv-client/dist/models/index.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/pagination.d.ts +22 -0
- package/node_modules/@redtidev/pixiv-client/dist/pagination.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/pagination.js +41 -0
- package/node_modules/@redtidev/pixiv-client/dist/pagination.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.d.ts +95 -0
- package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.js +344 -0
- package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/transport/transport.d.ts +65 -0
- package/node_modules/@redtidev/pixiv-client/dist/transport/transport.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/transport/transport.js +410 -0
- package/node_modules/@redtidev/pixiv-client/dist/transport/transport.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/types.d.ts +186 -0
- package/node_modules/@redtidev/pixiv-client/dist/types.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/types.js +3 -0
- package/node_modules/@redtidev/pixiv-client/dist/types.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/web-api/types.d.ts +19 -0
- package/node_modules/@redtidev/pixiv-client/dist/web-api/types.d.ts.map +1 -0
- package/node_modules/@redtidev/pixiv-client/dist/web-api/types.js +3 -0
- package/node_modules/@redtidev/pixiv-client/dist/web-api/types.js.map +1 -0
- package/node_modules/@redtidev/pixiv-client/package.json +55 -0
- package/node_modules/@redtidev/pixiv-client/src/__tests__/independence.test.ts +75 -0
- package/node_modules/@redtidev/pixiv-client/src/__tests__/integration.test.ts +268 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/__tests__/services.test.ts +199 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/exports.ts +5 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/illustrations.ts +144 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/media.ts +20 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/novels.ts +269 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/options.ts +73 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/tags.ts +21 -0
- package/node_modules/@redtidev/pixiv-client/src/app-api/users.ts +22 -0
- package/node_modules/@redtidev/pixiv-client/src/auth/types.ts +33 -0
- package/node_modules/@redtidev/pixiv-client/src/client.ts +105 -0
- package/node_modules/@redtidev/pixiv-client/src/errors/errors.ts +180 -0
- package/node_modules/@redtidev/pixiv-client/src/index.ts +91 -0
- package/node_modules/@redtidev/pixiv-client/src/logger.ts +18 -0
- package/node_modules/@redtidev/pixiv-client/src/models/index.ts +117 -0
- package/node_modules/@redtidev/pixiv-client/src/pagination.ts +46 -0
- package/node_modules/@redtidev/pixiv-client/src/rate-limit/RateLimitGate.ts +365 -0
- package/node_modules/@redtidev/pixiv-client/src/rate-limit/__tests__/RateLimitGate.test.ts +258 -0
- package/node_modules/@redtidev/pixiv-client/src/transport/__tests__/transport.test.ts +282 -0
- package/node_modules/@redtidev/pixiv-client/src/transport/transport.ts +500 -0
- package/node_modules/@redtidev/pixiv-client/src/types.ts +168 -0
- package/node_modules/@redtidev/pixiv-client/src/web-api/types.ts +19 -0
- package/node_modules/agent-base/LICENSE +22 -0
- package/node_modules/agent-base/README.md +69 -0
- package/node_modules/agent-base/dist/helpers.d.ts +15 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
- package/node_modules/agent-base/dist/helpers.js +66 -0
- package/node_modules/agent-base/dist/helpers.js.map +1 -0
- package/node_modules/agent-base/dist/index.d.ts +41 -0
- package/node_modules/agent-base/dist/index.d.ts.map +1 -0
- package/node_modules/agent-base/dist/index.js +178 -0
- package/node_modules/agent-base/dist/index.js.map +1 -0
- package/node_modules/agent-base/package.json +46 -0
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/axios/CHANGELOG.md +1934 -0
- package/node_modules/axios/LICENSE +7 -0
- package/node_modules/axios/MIGRATION_GUIDE.md +877 -0
- package/node_modules/axios/README.md +2851 -0
- package/node_modules/axios/dist/axios.js +5807 -0
- package/node_modules/axios/dist/axios.min.js +5 -0
- package/node_modules/axios/dist/axios.min.js.map +1 -0
- package/node_modules/axios/dist/browser/axios.cjs +5829 -0
- package/node_modules/axios/dist/esm/axios.js +5850 -0
- package/node_modules/axios/dist/esm/axios.min.js +3 -0
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
- package/node_modules/axios/dist/node/axios.cjs +6808 -0
- package/node_modules/axios/index.d.cts +766 -0
- package/node_modules/axios/index.d.ts +787 -0
- package/node_modules/axios/index.js +45 -0
- package/node_modules/axios/lib/adapters/README.md +36 -0
- package/node_modules/axios/lib/adapters/adapters.js +132 -0
- package/node_modules/axios/lib/adapters/fetch.js +696 -0
- package/node_modules/axios/lib/adapters/http.js +1490 -0
- package/node_modules/axios/lib/adapters/xhr.js +277 -0
- package/node_modules/axios/lib/axios.js +89 -0
- package/node_modules/axios/lib/cancel/CancelToken.js +135 -0
- package/node_modules/axios/lib/cancel/CanceledError.js +22 -0
- package/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/node_modules/axios/lib/core/Axios.js +306 -0
- package/node_modules/axios/lib/core/AxiosError.js +219 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
- package/node_modules/axios/lib/core/InterceptorManager.js +171 -0
- package/node_modules/axios/lib/core/README.md +8 -0
- package/node_modules/axios/lib/core/buildFullPath.js +76 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +95 -0
- package/node_modules/axios/lib/core/mergeConfig.js +174 -0
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
- package/node_modules/axios/lib/core/settle.js +27 -0
- package/node_modules/axios/lib/core/transformData.js +28 -0
- package/node_modules/axios/lib/defaults/index.js +178 -0
- package/node_modules/axios/lib/defaults/transitional.js +10 -0
- package/node_modules/axios/lib/env/README.md +3 -0
- package/node_modules/axios/lib/env/classes/FormData.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -0
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
- package/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
- package/node_modules/axios/lib/helpers/README.md +7 -0
- package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
- package/node_modules/axios/lib/helpers/bind.js +14 -0
- package/node_modules/axios/lib/helpers/buildURL.js +69 -0
- package/node_modules/axios/lib/helpers/callbackify.js +18 -0
- package/node_modules/axios/lib/helpers/combineURLs.js +23 -0
- package/node_modules/axios/lib/helpers/composeSignals.js +68 -0
- package/node_modules/axios/lib/helpers/cookies.js +64 -0
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
- package/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
- package/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
- package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/null.js +2 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
- package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
- package/node_modules/axios/lib/helpers/readBlob.js +15 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
- package/node_modules/axios/lib/helpers/speedometer.js +55 -0
- package/node_modules/axios/lib/helpers/spread.js +28 -0
- package/node_modules/axios/lib/helpers/throttle.js +45 -0
- package/node_modules/axios/lib/helpers/toFormData.js +279 -0
- package/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/node_modules/axios/lib/helpers/trackStream.js +89 -0
- package/node_modules/axios/lib/helpers/validator.js +112 -0
- package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/browser/index.js +13 -0
- package/node_modules/axios/lib/platform/common/utils.js +52 -0
- package/node_modules/axios/lib/platform/index.js +7 -0
- package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
- package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/node/index.js +37 -0
- package/node_modules/axios/lib/utils.js +1150 -0
- package/node_modules/axios/node_modules/agent-base/README.md +145 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/axios/node_modules/agent-base/package.json +64 -0
- package/node_modules/axios/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/axios/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/node_modules/debug/LICENSE +20 -0
- package/node_modules/axios/node_modules/debug/README.md +481 -0
- package/node_modules/axios/node_modules/debug/package.json +64 -0
- package/node_modules/axios/node_modules/debug/src/browser.js +272 -0
- package/node_modules/axios/node_modules/debug/src/common.js +292 -0
- package/node_modules/axios/node_modules/debug/src/index.js +10 -0
- package/node_modules/axios/node_modules/debug/src/node.js +263 -0
- package/node_modules/axios/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/axios/node_modules/ms/index.js +162 -0
- package/node_modules/axios/node_modules/ms/license.md +21 -0
- package/node_modules/axios/node_modules/ms/package.json +38 -0
- package/node_modules/axios/node_modules/ms/readme.md +59 -0
- package/node_modules/axios/package.json +203 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +80 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +6 -0
- package/node_modules/es-set-tostringtag/.eslintrc +13 -0
- package/node_modules/es-set-tostringtag/.nycrc +9 -0
- package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
- package/node_modules/es-set-tostringtag/LICENSE +21 -0
- package/node_modules/es-set-tostringtag/README.md +53 -0
- package/node_modules/es-set-tostringtag/index.d.ts +10 -0
- package/node_modules/es-set-tostringtag/index.js +35 -0
- package/node_modules/es-set-tostringtag/package.json +78 -0
- package/node_modules/es-set-tostringtag/test/index.js +85 -0
- package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
- package/node_modules/follow-redirects/LICENSE +18 -0
- package/node_modules/follow-redirects/README.md +157 -0
- package/node_modules/follow-redirects/debug.js +15 -0
- package/node_modules/follow-redirects/http.js +1 -0
- package/node_modules/follow-redirects/https.js +1 -0
- package/node_modules/follow-redirects/index.js +709 -0
- package/node_modules/follow-redirects/package.json +58 -0
- package/node_modules/form-data/CHANGELOG.md +686 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md +355 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +4 -0
- package/node_modules/form-data/lib/form_data.js +506 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/package.json +82 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/has-tostringtag/.eslintrc +5 -0
- package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
- package/node_modules/has-tostringtag/.nycrc +13 -0
- package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
- package/node_modules/has-tostringtag/LICENSE +21 -0
- package/node_modules/has-tostringtag/README.md +46 -0
- package/node_modules/has-tostringtag/index.d.ts +3 -0
- package/node_modules/has-tostringtag/index.js +8 -0
- package/node_modules/has-tostringtag/package.json +108 -0
- package/node_modules/has-tostringtag/shams.d.ts +3 -0
- package/node_modules/has-tostringtag/shams.js +8 -0
- package/node_modules/has-tostringtag/test/index.js +21 -0
- package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
- package/node_modules/has-tostringtag/test/tests.js +15 -0
- package/node_modules/has-tostringtag/tsconfig.json +49 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +58 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/ip-address/LICENSE +19 -0
- package/node_modules/ip-address/README.md +308 -0
- package/node_modules/ip-address/dist/address-error.d.ts +15 -0
- package/node_modules/ip-address/dist/address-error.js +12 -0
- package/node_modules/ip-address/dist/address-error.js.map +1 -0
- package/node_modules/ip-address/dist/common.d.ts +69 -0
- package/node_modules/ip-address/dist/common.js +142 -0
- package/node_modules/ip-address/dist/common.js.map +1 -0
- package/node_modules/ip-address/dist/ip-address.d.ts +7 -0
- package/node_modules/ip-address/dist/ip-address.js +35 -0
- package/node_modules/ip-address/dist/ip-address.js.map +1 -0
- package/node_modules/ip-address/dist/ipv4.d.ts +340 -0
- package/node_modules/ip-address/dist/ipv4.js +580 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -0
- package/node_modules/ip-address/dist/ipv6.d.ts +630 -0
- package/node_modules/ip-address/dist/ipv6.js +1443 -0
- package/node_modules/ip-address/dist/ipv6.js.map +1 -0
- package/node_modules/ip-address/dist/v4/constants.d.ts +16 -0
- package/node_modules/ip-address/dist/v4/constants.js +51 -0
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -0
- package/node_modules/ip-address/dist/v6/constants.d.ts +58 -0
- package/node_modules/ip-address/dist/v6/constants.js +128 -0
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -0
- package/node_modules/ip-address/dist/v6/helpers.d.ts +18 -0
- package/node_modules/ip-address/dist/v6/helpers.js +54 -0
- package/node_modules/ip-address/dist/v6/helpers.js.map +1 -0
- package/node_modules/ip-address/dist/v6/regular-expressions.d.ts +5 -0
- package/node_modules/ip-address/dist/v6/regular-expressions.js +95 -0
- package/node_modules/ip-address/dist/v6/regular-expressions.js.map +1 -0
- package/node_modules/ip-address/package.json +90 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/mime-db/README.md +100 -0
- package/node_modules/mime-db/db.json +8519 -0
- package/node_modules/mime-db/index.js +12 -0
- package/node_modules/mime-db/package.json +60 -0
- package/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/mime-types/README.md +113 -0
- package/node_modules/mime-types/index.js +188 -0
- package/node_modules/mime-types/package.json +44 -0
- package/node_modules/proxy-from-env/LICENSE +20 -0
- package/node_modules/proxy-from-env/README.md +163 -0
- package/node_modules/proxy-from-env/index.cjs +105 -0
- package/node_modules/proxy-from-env/index.js +103 -0
- package/node_modules/proxy-from-env/package.json +43 -0
- package/node_modules/smart-buffer/.prettierrc.yaml +5 -0
- package/node_modules/smart-buffer/.travis.yml +13 -0
- package/node_modules/smart-buffer/LICENSE +20 -0
- package/node_modules/smart-buffer/README.md +633 -0
- package/node_modules/smart-buffer/build/smartbuffer.js +1233 -0
- package/node_modules/smart-buffer/build/smartbuffer.js.map +1 -0
- package/node_modules/smart-buffer/build/utils.js +108 -0
- package/node_modules/smart-buffer/build/utils.js.map +1 -0
- package/node_modules/smart-buffer/docs/CHANGELOG.md +70 -0
- package/node_modules/smart-buffer/docs/README_v3.md +367 -0
- package/node_modules/smart-buffer/docs/ROADMAP.md +0 -0
- package/node_modules/smart-buffer/package.json +79 -0
- package/node_modules/smart-buffer/typings/smartbuffer.d.ts +755 -0
- package/node_modules/smart-buffer/typings/utils.d.ts +66 -0
- package/node_modules/socks/.eslintrc.cjs +11 -0
- package/node_modules/socks/.prettierrc.yaml +7 -0
- package/node_modules/socks/LICENSE +20 -0
- package/node_modules/socks/README.md +686 -0
- package/node_modules/socks/build/client/socksclient.js +793 -0
- package/node_modules/socks/build/client/socksclient.js.map +1 -0
- package/node_modules/socks/build/common/constants.js +108 -0
- package/node_modules/socks/build/common/constants.js.map +1 -0
- package/node_modules/socks/build/common/helpers.js +167 -0
- package/node_modules/socks/build/common/helpers.js.map +1 -0
- package/node_modules/socks/build/common/receivebuffer.js +43 -0
- package/node_modules/socks/build/common/receivebuffer.js.map +1 -0
- package/node_modules/socks/build/common/util.js +25 -0
- package/node_modules/socks/build/common/util.js.map +1 -0
- package/node_modules/socks/build/index.js +18 -0
- package/node_modules/socks/build/index.js.map +1 -0
- package/node_modules/socks/docs/examples/index.md +17 -0
- package/node_modules/socks/docs/examples/javascript/associateExample.md +90 -0
- package/node_modules/socks/docs/examples/javascript/bindExample.md +83 -0
- package/node_modules/socks/docs/examples/javascript/connectExample.md +258 -0
- package/node_modules/socks/docs/examples/typescript/associateExample.md +93 -0
- package/node_modules/socks/docs/examples/typescript/bindExample.md +86 -0
- package/node_modules/socks/docs/examples/typescript/connectExample.md +265 -0
- package/node_modules/socks/docs/index.md +5 -0
- package/node_modules/socks/docs/migratingFromV1.md +86 -0
- package/node_modules/socks/package.json +58 -0
- package/node_modules/socks/typings/client/socksclient.d.ts +162 -0
- package/node_modules/socks/typings/common/constants.d.ts +151 -0
- package/node_modules/socks/typings/common/helpers.d.ts +17 -0
- package/node_modules/socks/typings/common/receivebuffer.d.ts +12 -0
- package/node_modules/socks/typings/common/util.d.ts +14 -0
- package/node_modules/socks/typings/index.d.ts +1 -0
- package/node_modules/socks-proxy-agent/LICENSE +22 -0
- package/node_modules/socks-proxy-agent/README.md +50 -0
- package/node_modules/socks-proxy-agent/dist/index.d.ts +27 -0
- package/node_modules/socks-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/socks-proxy-agent/dist/index.js +195 -0
- package/node_modules/socks-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/LICENSE +20 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/README.md +481 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/package.json +64 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/src/browser.js +272 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/src/common.js +292 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/src/index.js +10 -0
- package/node_modules/socks-proxy-agent/node_modules/debug/src/node.js +263 -0
- package/node_modules/socks-proxy-agent/node_modules/ms/index.js +162 -0
- package/node_modules/socks-proxy-agent/node_modules/ms/license.md +21 -0
- package/node_modules/socks-proxy-agent/node_modules/ms/package.json +38 -0
- package/node_modules/socks-proxy-agent/node_modules/ms/readme.md +59 -0
- package/node_modules/socks-proxy-agent/package.json +142 -0
- package/node_modules/undici/LICENSE +21 -0
- package/node_modules/undici/README.md +473 -0
- package/node_modules/undici/docs/docs/api/Agent.md +80 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/undici/docs/docs/api/Client.md +277 -0
- package/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +101 -0
- package/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +204 -0
- package/node_modules/undici/docs/docs/api/DispatchInterceptor.md +60 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1347 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +162 -0
- package/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +52 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +540 -0
- package/node_modules/undici/docs/docs/api/MockClient.md +77 -0
- package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/undici/docs/docs/api/MockPool.md +547 -0
- package/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +131 -0
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +96 -0
- package/node_modules/undici/docs/docs/api/RetryAgent.md +45 -0
- package/node_modules/undici/docs/docs/api/RetryHandler.md +117 -0
- package/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/undici/docs/docs/api/WebSocket.md +51 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +136 -0
- package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +20 -0
- package/node_modules/undici/index-fetch.js +35 -0
- package/node_modules/undici/index.d.ts +3 -0
- package/node_modules/undici/index.js +169 -0
- package/node_modules/undici/lib/api/abort-signal.js +57 -0
- package/node_modules/undici/lib/api/api-connect.js +108 -0
- package/node_modules/undici/lib/api/api-pipeline.js +251 -0
- package/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/undici/lib/api/api-stream.js +220 -0
- package/node_modules/undici/lib/api/api-upgrade.js +108 -0
- package/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/undici/lib/api/readable.js +385 -0
- package/node_modules/undici/lib/api/util.js +93 -0
- package/node_modules/undici/lib/core/connect.js +240 -0
- package/node_modules/undici/lib/core/constants.js +118 -0
- package/node_modules/undici/lib/core/diagnostics.js +202 -0
- package/node_modules/undici/lib/core/errors.js +425 -0
- package/node_modules/undici/lib/core/request.js +416 -0
- package/node_modules/undici/lib/core/symbols.js +67 -0
- package/node_modules/undici/lib/core/tree.js +152 -0
- package/node_modules/undici/lib/core/util.js +719 -0
- package/node_modules/undici/lib/dispatcher/agent.js +129 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +209 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +1496 -0
- package/node_modules/undici/lib/dispatcher/client-h2.js +744 -0
- package/node_modules/undici/lib/dispatcher/client.js +623 -0
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +199 -0
- package/node_modules/undici/lib/dispatcher/dispatcher.js +65 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +160 -0
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +117 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +194 -0
- package/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
- package/node_modules/undici/lib/dispatcher/pool.js +107 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +274 -0
- package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/undici/lib/global.js +32 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +44 -0
- package/node_modules/undici/lib/handler/redirect-handler.js +232 -0
- package/node_modules/undici/lib/handler/retry-handler.js +408 -0
- package/node_modules/undici/lib/interceptor/dns.js +375 -0
- package/node_modules/undici/lib/interceptor/dump.js +123 -0
- package/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
- package/node_modules/undici/lib/interceptor/redirect.js +24 -0
- package/node_modules/undici/lib/interceptor/response-error.js +86 -0
- package/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/llhttp/constants.js +278 -0
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +5 -0
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +5 -0
- package/node_modules/undici/lib/llhttp/utils.js +15 -0
- package/node_modules/undici/lib/mock/mock-agent.js +160 -0
- package/node_modules/undici/lib/mock/mock-client.js +59 -0
- package/node_modules/undici/lib/mock/mock-errors.js +28 -0
- package/node_modules/undici/lib/mock/mock-interceptor.js +207 -0
- package/node_modules/undici/lib/mock/mock-pool.js +59 -0
- package/node_modules/undici/lib/mock/mock-symbols.js +23 -0
- package/node_modules/undici/lib/mock/mock-utils.js +367 -0
- package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/undici/lib/mock/pluralizer.js +29 -0
- package/node_modules/undici/lib/util/timers.js +423 -0
- package/node_modules/undici/lib/web/cache/cache.js +859 -0
- package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/undici/lib/web/cache/symbols.js +5 -0
- package/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/undici/lib/web/cookies/index.js +184 -0
- package/node_modules/undici/lib/web/cookies/parse.js +310 -0
- package/node_modules/undici/lib/web/cookies/util.js +352 -0
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +398 -0
- package/node_modules/undici/lib/web/eventsource/eventsource.js +480 -0
- package/node_modules/undici/lib/web/eventsource/util.js +37 -0
- package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/undici/lib/web/fetch/body.js +529 -0
- package/node_modules/undici/lib/web/fetch/constants.js +124 -0
- package/node_modules/undici/lib/web/fetch/data-url.js +744 -0
- package/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/node_modules/undici/lib/web/fetch/file.js +126 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +474 -0
- package/node_modules/undici/lib/web/fetch/formdata.js +252 -0
- package/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/undici/lib/web/fetch/headers.js +687 -0
- package/node_modules/undici/lib/web/fetch/index.js +2272 -0
- package/node_modules/undici/lib/web/fetch/request.js +1037 -0
- package/node_modules/undici/lib/web/fetch/response.js +610 -0
- package/node_modules/undici/lib/web/fetch/symbols.js +9 -0
- package/node_modules/undici/lib/web/fetch/util.js +1632 -0
- package/node_modules/undici/lib/web/fetch/webidl.js +695 -0
- package/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
- package/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
- package/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
- package/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
- package/node_modules/undici/lib/web/fileapi/util.js +391 -0
- package/node_modules/undici/lib/web/websocket/connection.js +371 -0
- package/node_modules/undici/lib/web/websocket/constants.js +66 -0
- package/node_modules/undici/lib/web/websocket/events.js +329 -0
- package/node_modules/undici/lib/web/websocket/frame.js +96 -0
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +513 -0
- package/node_modules/undici/lib/web/websocket/sender.js +104 -0
- package/node_modules/undici/lib/web/websocket/symbols.js +12 -0
- package/node_modules/undici/lib/web/websocket/util.js +322 -0
- package/node_modules/undici/lib/web/websocket/websocket.js +595 -0
- package/node_modules/undici/package.json +160 -0
- package/node_modules/undici/scripts/strip-comments.js +8 -0
- package/node_modules/undici/types/README.md +6 -0
- package/node_modules/undici/types/agent.d.ts +31 -0
- package/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/undici/types/balanced-pool.d.ts +29 -0
- package/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/undici/types/client.d.ts +125 -0
- package/node_modules/undici/types/connector.d.ts +34 -0
- package/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/undici/types/cookies.d.ts +28 -0
- package/node_modules/undici/types/diagnostics-channel.d.ts +66 -0
- package/node_modules/undici/types/dispatcher.d.ts +256 -0
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +21 -0
- package/node_modules/undici/types/errors.d.ts +155 -0
- package/node_modules/undici/types/eventsource.d.ts +61 -0
- package/node_modules/undici/types/fetch.d.ts +209 -0
- package/node_modules/undici/types/file.d.ts +39 -0
- package/node_modules/undici/types/filereader.d.ts +54 -0
- package/node_modules/undici/types/formdata.d.ts +108 -0
- package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/undici/types/handlers.d.ts +15 -0
- package/node_modules/undici/types/header.d.ts +4 -0
- package/node_modules/undici/types/index.d.ts +71 -0
- package/node_modules/undici/types/interceptors.d.ts +32 -0
- package/node_modules/undici/types/mock-agent.d.ts +50 -0
- package/node_modules/undici/types/mock-client.d.ts +25 -0
- package/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici/types/mock-pool.d.ts +25 -0
- package/node_modules/undici/types/patch.d.ts +33 -0
- package/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/undici/types/pool.d.ts +39 -0
- package/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/undici/types/readable.d.ts +65 -0
- package/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/undici/types/retry-handler.d.ts +116 -0
- package/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/undici/types/webidl.d.ts +228 -0
- package/node_modules/undici/types/websocket.d.ts +150 -0
- package/package.json +4 -1
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
[](https://github.com/beaugunderson/ip-address/actions/workflows/ci.yml)
|
|
2
|
+
[![codecov]](https://codecov.io/github/beaugunderson/ip-address?branch=main)
|
|
3
|
+
[![downloads]](https://www.npmjs.com/package/ip-address)
|
|
4
|
+
[![npm]](https://www.npmjs.com/package/ip-address)
|
|
5
|
+
|
|
6
|
+
[codecov]: https://codecov.io/github/beaugunderson/ip-address/coverage.svg?branch=main
|
|
7
|
+
[downloads]: https://img.shields.io/npm/dm/ip-address.svg
|
|
8
|
+
[npm]: https://img.shields.io/npm/v/ip-address.svg
|
|
9
|
+
|
|
10
|
+
## ip-address
|
|
11
|
+
|
|
12
|
+
`ip-address` is a library for validating and manipulating IPv4 and IPv6 addresses in JavaScript and TypeScript.
|
|
13
|
+
|
|
14
|
+
### Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install ip-address
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Examples
|
|
21
|
+
|
|
22
|
+
<!-- prettier-ignore -->
|
|
23
|
+
```ts
|
|
24
|
+
import { Address4, Address6 } from 'ip-address';
|
|
25
|
+
|
|
26
|
+
// Validation
|
|
27
|
+
Address4.isValid('192.168.1.1'); // true
|
|
28
|
+
Address6.isValid('2001:db8::1'); // true
|
|
29
|
+
Address6.isValid('not an address'); // false
|
|
30
|
+
|
|
31
|
+
// Parsing (throws AddressError on invalid input)
|
|
32
|
+
const v4 = new Address4('192.168.1.1/24');
|
|
33
|
+
const v6 = new Address6('2001:db8::1/64');
|
|
34
|
+
|
|
35
|
+
// Subnet membership
|
|
36
|
+
const host = new Address4('192.168.1.42');
|
|
37
|
+
const network = new Address4('192.168.1.0/24');
|
|
38
|
+
host.isInSubnet(network); // true
|
|
39
|
+
|
|
40
|
+
// Subnet range
|
|
41
|
+
network.startAddress().correctForm(); // '192.168.1.0'
|
|
42
|
+
network.endAddress().correctForm(); // '192.168.1.255'
|
|
43
|
+
|
|
44
|
+
// Strict network-address check (host bits must be zero).
|
|
45
|
+
// isValid() accepts CIDRs with host bits set — '192.168.1.5/24' is a valid
|
|
46
|
+
// host-with-subnet, but it isn't a network address.
|
|
47
|
+
const cidr = new Address4('192.168.1.5/24');
|
|
48
|
+
Address4.isValid('192.168.1.5/24'); // true
|
|
49
|
+
cidr.correctForm() === cidr.startAddress().correctForm(); // false
|
|
50
|
+
|
|
51
|
+
// Address properties
|
|
52
|
+
const link = new Address6('fe80::1');
|
|
53
|
+
link.isLinkLocal(); // true
|
|
54
|
+
link.isMulticast(); // false
|
|
55
|
+
link.isLoopback(); // false
|
|
56
|
+
|
|
57
|
+
new Address4('192.168.1.1').isPrivate(); // true (RFC 1918)
|
|
58
|
+
new Address6('fc00::1').isULA(); // true (RFC 4193)
|
|
59
|
+
|
|
60
|
+
// Numeric and byte representations
|
|
61
|
+
v4.bigInt(); // 3232235777n
|
|
62
|
+
v4.toArray(); // [192, 168, 1, 1]
|
|
63
|
+
v6.canonicalForm(); // '2001:0db8:0000:0000:0000:0000:0000:0001'
|
|
64
|
+
|
|
65
|
+
// Embedded IPv4 + Teredo
|
|
66
|
+
const teredo = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe');
|
|
67
|
+
teredo.inspectTeredo().client4; // '157.60.0.1'
|
|
68
|
+
|
|
69
|
+
// Parse host + port from a URL
|
|
70
|
+
Address6.fromURL('http://[2001:db8::1]:8080/').port; // 8080
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Features
|
|
74
|
+
|
|
75
|
+
- Written in TypeScript with full type definitions; usable from CommonJS and ESM
|
|
76
|
+
- Zero runtime dependencies
|
|
77
|
+
- Parses dotted-quad IPv4 and [RFC 4291](https://datatracker.ietf.org/doc/html/rfc4291) IPv6 notation, including subnets and zones. The `inet_aton` forms (`2130706433`, `0x7f000001`, `127.1`) and leading-zero octets are rejected by design — see [SECURITY.md](./SECURITY.md#classifiers-are-not-an-ssrf-defense)
|
|
78
|
+
- Parses IPv6 hosts (and ports) from URLs via `Address6.fromURL(url)`
|
|
79
|
+
- Subnet membership checks (`isInSubnet`) and range queries (`startAddress` / `endAddress`)
|
|
80
|
+
- Special-property checks: private (RFC 1918) / ULA (RFC 4193), loopback, link-local, multicast, broadcast, unspecified, CGNAT, documentation, Teredo, 6to4, v4-in-v6
|
|
81
|
+
- Decodes [Teredo](http://en.wikipedia.org/wiki/Teredo_tunneling#IPv6_addressing) and 6to4 tunneling information
|
|
82
|
+
- Conversions: canonical/correct form, hex, binary, decimal, byte arrays, BigInt, `in-addr.arpa` / `ip6.arpa`
|
|
83
|
+
- Runs in Node.js and the browser
|
|
84
|
+
- Thousands of test cases
|
|
85
|
+
|
|
86
|
+
### Terminology
|
|
87
|
+
|
|
88
|
+
A few terms used throughout the API can be confusing if you haven't worked deeply with IPv6 before:
|
|
89
|
+
|
|
90
|
+
- **Correct form** — the shortest valid representation, per [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros stripped, the longest run of zero groups collapsed to `::`, and hex digits lowercased (e.g. `2001:db8::1`). This is what most software displays.
|
|
91
|
+
- **Canonical form** — the fully expanded representation: all 8 groups, each padded to 4 hex digits, no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison.
|
|
92
|
+
- **Subnet** — the network portion of an address expressed as a CIDR prefix length (e.g. `/24` for IPv4, `/64` for IPv6). `startAddress()` / `endAddress()` return the bounds of the subnet's range.
|
|
93
|
+
- **Zone** — the IPv6 scope identifier appended after `%`, used to disambiguate link-local addresses across interfaces (e.g. `fe80::1%eth0`).
|
|
94
|
+
- **v4-in-v6** — mixed notation that embeds an IPv4 address as the last 32 bits of an IPv6 address, e.g. `::ffff:192.168.0.1`. Used for IPv4-mapped IPv6 addresses.
|
|
95
|
+
- **Teredo** — a tunneling protocol that encodes an IPv4 endpoint, port, and flags inside a `2001::/32` IPv6 address. `inspectTeredo()` decodes those fields.
|
|
96
|
+
- **6to4** — a tunneling protocol that embeds a full 32-bit IPv4 address in bits 16–47 of a `2002::/16` IPv6 address, i.e. the second and third groups (`192.0.2.4` becomes `2002:c000:204::`). `inspect6to4()` decodes the embedded v4 address.
|
|
97
|
+
|
|
98
|
+
### API
|
|
99
|
+
|
|
100
|
+
<!-- API:START -->
|
|
101
|
+
|
|
102
|
+
<details>
|
|
103
|
+
<summary><a id="address4"></a><strong>Address4</strong> — Represents an IPv4 address</summary>
|
|
104
|
+
|
|
105
|
+
**Constructor**
|
|
106
|
+
|
|
107
|
+
- `new Address4(address: string): Address4`
|
|
108
|
+
|
|
109
|
+
**Static methods**
|
|
110
|
+
|
|
111
|
+
- `static isValid(address: string): boolean` — Returns true if the given string is a valid IPv4 address (with optional CIDR subnet), false otherwise. Host bits in the subnet portion are allowed (e.g. `192.168.1.5/24` is valid); for strict network-address validation compare `correctForm()` to `startAddress().correctForm()`, or use `networkForm()`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L53)
|
|
112
|
+
- `static fromAddressAndMask(address: string, mask: string): Address4` — Construct an `Address4` from an address and a dotted-decimal subnet mask given as separate strings (e.g. as returned by Node's `os.networkInterfaces()`). Throws `AddressError` if the mask is non-contiguous (e.g. `255.0.255.0`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L110)
|
|
113
|
+
- `static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4` — Construct an `Address4` from an address and a Cisco-style wildcard mask given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard mask is the bitwise inverse of the subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g. `0.255.0.255`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L124)
|
|
114
|
+
- `static fromWildcard(input: string): Address4` — Construct an `Address4` from a wildcard pattern with trailing `*` octets. The number of trailing wildcards determines the prefix length: each `*` represents 8 bits. Only trailing whole-octet wildcards are supported. Partial-octet wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g. `192.*.0.1`) throw `AddressError`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L145)
|
|
115
|
+
- `static fromHex(hex: string): Address4` — Converts a hex string to an IPv4 address object. Accepts 8 hex digits with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`). Throws `AddressError` for any other length or for non-hex characters. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L180)
|
|
116
|
+
- `static fromInteger(integer: number): Address4` — Converts an integer into a IPv4 address object. The integer must be a non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L203)
|
|
117
|
+
- `static fromArpa(arpaFormAddress: string): Address4` — Return an address from in-addr.arpa form [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L219)
|
|
118
|
+
- `static fromBigInt(bigInt: bigint): Address4` — Converts a BigInt to a v4 address object. The value must be in the range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L400)
|
|
119
|
+
- `static fromByteArray(bytes: number[]): Address4` — Convert a byte array to an Address4 object. Throws `AddressError` unless given exactly 4 integers from 0 to 255. Signed bytes are rejected, so this differs from `Address6.fromByteArray`, which folds them; the two contracts converge on this stricter form in the next major version. To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L418)
|
|
120
|
+
- `static fromUnsignedByteArray(bytes: number[]): Address4` — Convert an unsigned byte array to an Address4 object. Throws `AddressError` unless given exactly 4 bytes, and rejects values outside 0 to 255 when parsing the resulting address. To convert from a Node.js `Buffer`, spread it: `Address4.fromUnsignedByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L434)
|
|
121
|
+
|
|
122
|
+
**Instance methods**
|
|
123
|
+
|
|
124
|
+
- `parse(address: string): string[]` — Parses an IPv4 address string into its four octet groups and stores the result on `this.parsedAddress`. Called automatically by the constructor; you typically don't need to call it directly. Throws `AddressError` if the input is not a valid IPv4 address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L70)
|
|
125
|
+
- `correctForm(): string` — Returns the address in correct form: octets joined with `.` and any leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the canonical dotted-decimal representation. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L91)
|
|
126
|
+
- `toHex(): string` — Converts an IPv4 address object to a hex string [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L232)
|
|
127
|
+
- `toArray(): number[]` — Converts an IPv4 address object to an array of bytes. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L242)
|
|
128
|
+
- `toGroup6(): string` — Converts an IPv4 address object to an IPv6 address group [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L250)
|
|
129
|
+
- `bigInt(): bigint` — Returns the address as a `bigint` [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L269)
|
|
130
|
+
- `startAddress(): Address4` — The first address in the range given by this address' subnet. Often referred to as the Network Address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L286)
|
|
131
|
+
- `startAddressExclusive(): Address4` — The first host address in the range given by this address's subnet ie the first address after the Network Address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L295)
|
|
132
|
+
- `offset(n: number | bigint): Address4` — Returns the address `n` addresses after this one (or before, when `n` is negative), keeping this address's subnet mask. Throws `AddressError` when the result would fall outside the IPv4 address space or `n` is not an integer. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L310)
|
|
133
|
+
- `nextNetwork(): Address4` — Returns the network that follows this address's network: the address after endAddress, with the same subnet mask. Throws `AddressError` when this network is the last one in the address space. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L324)
|
|
134
|
+
- `endAddress(): Address4` — The last address in the range given by this address' subnet Often referred to as the Broadcast [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L347)
|
|
135
|
+
- `endAddressExclusive(): Address4` — The last host address in the range given by this address's subnet ie the last address prior to the Broadcast Address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L356)
|
|
136
|
+
- `subnetMaskAddress(): Address4` — The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for a `/20`. Returns an `Address4`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L366)
|
|
137
|
+
- `wildcardMask(): Address4` — The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L378)
|
|
138
|
+
- `networkForm(): string` — The network address in CIDR string form, e.g. `192.168.1.0/24` for `192.168.1.5/24`. For an address with no explicit subnet the prefix is `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L390)
|
|
139
|
+
- `mask(mask?: number): string` — Returns the first n bits of the address, defaulting to the subnet mask [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L448)
|
|
140
|
+
- `getBitsBase2(start: number, end: number): string` — Returns the bits in the given range as a base-2 string [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L460)
|
|
141
|
+
- `reverseForm(options?: ReverseFormOptions): string` — Return the reversed in-addr.arpa form of the address, e.g. `42.2.0.192.in-addr.arpa.` for `192.0.2.42`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L471)
|
|
142
|
+
- `isMulticast(): boolean` — Returns true if the given address is a multicast address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L505)
|
|
143
|
+
- `isPrivate(): boolean` — Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L513)
|
|
144
|
+
- `isLoopback(): boolean` — Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L521)
|
|
145
|
+
- `isLinkLocal(): boolean` — Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L529)
|
|
146
|
+
- `isUnspecified(): boolean` — Returns true if the address is the unspecified address `0.0.0.0`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L537)
|
|
147
|
+
- `isBroadcast(): boolean` — Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L545)
|
|
148
|
+
- `isCGNAT(): boolean` — Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L553)
|
|
149
|
+
- `isDocumentation(): boolean` — Returns true if the address is in one of the documentation ranges `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L562)
|
|
150
|
+
- `isBenchmarking(): boolean` — Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L570)
|
|
151
|
+
- `isReserved(): boolean` — Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)), which includes the limited broadcast address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L579)
|
|
152
|
+
- `isGlobal(): boolean` — Returns true if the address is globally reachable: not multicast, and not in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/) marks as not globally reachable. That covers everything the individual classifiers name (private, loopback, link-local, CGNAT, unspecified, broadcast, documentation, benchmarking, reserved) and the blocks they do not, such as `0.0.0.0/8` and the IETF protocol assignments in `192.0.0.0/24`. This is the single predicate to use where a request must not reach an internal or special-purpose destination; see SECURITY.md. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L594)
|
|
153
|
+
- `binaryZeroPad(): string` — Returns a zero-padded base-2 string representation of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L602)
|
|
154
|
+
- `groupForV6(): string` — Groups an IPv4 address for inclusion at the end of an IPv6 address. Returns an HTML fragment: each half of the address is wrapped in a `<span>` carrying the group classes an address-inspector UI hovers on. The address content is HTML-escaped; anything you concatenate around it is your responsibility. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L618)
|
|
155
|
+
|
|
156
|
+
**Properties**
|
|
157
|
+
|
|
158
|
+
- `address: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L14)
|
|
159
|
+
- `addressMinusSuffix: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L15)
|
|
160
|
+
- `groups: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L16)
|
|
161
|
+
- `parsedAddress: string[]` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L17)
|
|
162
|
+
- `parsedSubnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L18)
|
|
163
|
+
- `subnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L19)
|
|
164
|
+
- `subnetMask: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L20)
|
|
165
|
+
- `v4: boolean` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L21)
|
|
166
|
+
- `isCorrect: () => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L99)
|
|
167
|
+
- `isInSubnet: (address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L489)
|
|
168
|
+
- `isHostInSubnet: (address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. Prefer this over `isInSubnet` when classifying a single address, so the answer doesn't change with the CIDR suffix the caller happened to write — notably when the address came from untrusted input and the result backs a trust-boundary decision. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv4.ts#L499)
|
|
169
|
+
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
<details>
|
|
173
|
+
<summary><a id="address6"></a><strong>Address6</strong> — Represents an IPv6 address</summary>
|
|
174
|
+
|
|
175
|
+
**Constructor**
|
|
176
|
+
|
|
177
|
+
- `new Address6(address: string, optionalGroups?: number): Address6`
|
|
178
|
+
|
|
179
|
+
**Static methods**
|
|
180
|
+
|
|
181
|
+
- `static isValid(address: string): boolean` — Returns true if the given string is a valid IPv6 address (with optional CIDR subnet and zone identifier), false otherwise. Host bits in the subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict network-address validation compare `correctForm()` to `startAddress().correctForm()`, or use `networkForm()`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L167)
|
|
182
|
+
- `static fromBigInt(bigInt: bigint): Address6` — Convert a BigInt to a v6 address object. The value must be in the range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L188)
|
|
183
|
+
- `static fromURL(url: string): { error: string; address: null; port: null } | { error?: undefined; address: Address6; port: number | null }` — Parse a URL (with optional bracketed host and port) into an address and port. Returns either `{ address, port }` on success or `{ error, address: null, port: null }` if the URL could not be parsed. Ports are returned as numbers (or `null` if absent or out of range). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L213)
|
|
184
|
+
- `static fromAddressAndMask(address: string, mask: string): Address6` — Construct an `Address6` from an address and a hex subnet mask given as separate strings (e.g. as returned by Node's `os.networkInterfaces()`). Throws `AddressError` if the mask is non-contiguous (e.g. `ffff::ffff`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L280)
|
|
185
|
+
- `static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6` — Construct an `Address6` from an address and a Cisco-style wildcard mask given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`). The wildcard mask is the bitwise inverse of the subnet mask. Throws `AddressError` if the mask is non-contiguous. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L294)
|
|
186
|
+
- `static fromWildcard(input: string): Address6` — Construct an `Address6` from a wildcard pattern with trailing `*` groups. The number of trailing wildcards determines the prefix length: each `*` represents 16 bits. `::` is expanded to zero groups (not wildcards) before evaluating trailing wildcards. Only trailing whole-group wildcards are supported. Partial-group wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g. `*::1`) throw `AddressError`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L316)
|
|
187
|
+
- `static fromAddress4(address: string): Address6` — Create an IPv6-mapped address given an IPv4 address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L377)
|
|
188
|
+
- `static fromArpa(arpaFormAddress: string): Address6` — Return an address from ip6.arpa form. A full 32-nibble name gives a /128 address; a shorter name, as used for a delegated reverse zone, gives the network it covers, with a subnet mask of four bits per nibble, so `fromArpa(x.reverseForm())` round-trips reverseForm for any prefix. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L397)
|
|
189
|
+
- `static fromAddress4Nat64(address: string, prefix?: string): Address6` — Embed an IPv4 address into a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. The prefix length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter than /64 the IPv4 octets are split around the reserved bits 64–71. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1103)
|
|
190
|
+
- `static fromByteArray(bytes: number[]): Address6` — Convert a byte array to an Address6 object. Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an `Int8Array` or a Java `byte[]` holds them), folding signed values to their unsigned equivalent. Throws `AddressError` unless given exactly 16 integers from -128 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1218)
|
|
191
|
+
- `static fromUnsignedByteArray(bytes: number[]): Address6` — Convert an unsigned byte array to an Address6 object. Throws `AddressError` unless given exactly 16 integers from 0 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1235)
|
|
192
|
+
|
|
193
|
+
**Instance methods**
|
|
194
|
+
|
|
195
|
+
- `microsoftTranscription(): string` — Return the Microsoft UNC transcription of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L421)
|
|
196
|
+
- `mask(mask?: number): string` — Return the first n bits of the address, defaulting to the subnet mask [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L430)
|
|
197
|
+
- `possibleSubnets(subnetSize?: number): string` — Return the number of possible subnets of a given size in the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L440)
|
|
198
|
+
- `startAddress(): Address6` — The first address in the range given by this address' subnet Often referred to as the Network Address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L465)
|
|
199
|
+
- `startAddressExclusive(): Address6` — The first host address in the range given by this address's subnet ie the first address after the Network Address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L474)
|
|
200
|
+
- `endAddress(): Address6` — The last address in the range given by this address's subnet. IPv6 has no broadcast address, so this is an ordinary assignable address (in a 64-bit-interface-identifier subnet it falls inside the reserved subnet-anycast block of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L494)
|
|
201
|
+
- `endAddressExclusive(): Address6` — The address one before endAddress. This is the IPv6 counterpart of the IPv4 method that skips the broadcast address; IPv6 has no broadcast, so it drops exactly one address and does not model the 128 reserved subnet-anycast identifiers of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L505)
|
|
202
|
+
- `offset(n: number | bigint): Address6` — Returns the address `n` addresses after this one (or before, when `n` is negative), keeping this address's subnet mask. Throws `AddressError` when the result would fall outside the IPv6 address space or `n` is not an integer. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L520)
|
|
203
|
+
- `nextNetwork(): Address6` — Returns the network that follows this address's network: the address after endAddress, with the same subnet mask. Throws `AddressError` when this network is the last one in the address space. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L534)
|
|
204
|
+
- `subnetMaskAddress(): Address6` — The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a `/64`. Returns an `Address6`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L549)
|
|
205
|
+
- `wildcardMask(): Address6` — The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns an `Address6`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L561)
|
|
206
|
+
- `networkForm(): string` — The network address in CIDR string form, e.g. `2001:db8::/32` for `2001:db8::1/32`. For an address with no explicit subnet the prefix is `/128`, e.g. `networkForm()` on `2001:db8::1` returns `2001:db8::1/128`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L574)
|
|
207
|
+
- `getScope(): string` — Return the scope of the address. The 4-bit scope field ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7)) is only defined for multicast addresses; for unicast addresses the scope is derived from the address type per [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L586)
|
|
208
|
+
- `getType(): string` — Return the type of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L613)
|
|
209
|
+
- `getBits(start: number, end: number): bigint` — Return the bits in the given range as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L628)
|
|
210
|
+
- `getBitsBase2(start: number, end: number): string` — Return the bits in the given range as a base-2 string [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L636)
|
|
211
|
+
- `getBitsBase16(start: number, end: number): string` — Return the bits in the given range as a base-16 string [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L644)
|
|
212
|
+
- `getBitsPastSubnet(): string` — Return the bits that are set past the subnet mask length [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L660)
|
|
213
|
+
- `reverseForm(options?: ReverseFormOptions): string` — Return the reversed ip6.arpa form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L670)
|
|
214
|
+
- `correctForm(): string` — Returns the address in correct form, per [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros stripped, the longest run of zero groups collapsed to `::`, and hex digits lowercased (e.g. `2001:db8::1`). This is the recommended form for display. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L705)
|
|
215
|
+
- `binaryZeroPad(): string` — Return a zero-padded base-2 string representation of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L767)
|
|
216
|
+
- `parse4in6(address: string): string` — Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the trailing IPv4 address into `this.address4` / `this.parsedAddress4` and returning the address with the v4 portion converted to two v6 groups. Used internally by `parse()`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L781)
|
|
217
|
+
- `parse(address: string): string[]` — Parses an IPv6 address string into its 8 hexadecimal groups (expanding any `::` elision and any trailing v4-in-v6 portion) and stores the result on `this.parsedAddress`. Called automatically by the constructor; you typically don't need to call it directly. Throws `AddressError` if the input is malformed. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L838)
|
|
218
|
+
- `canonicalForm(): string` — Returns the canonical (fully expanded) form of the address: all 8 groups, each padded to 4 hex digits, with no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L918)
|
|
219
|
+
- `decimal(): string` — Return the decimal form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L926)
|
|
220
|
+
- `bigInt(): bigint` — Return the address as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L934)
|
|
221
|
+
- `to4(): Address4` — Return the last two groups of this address as an IPv4 address string. If this address carries a CIDR prefix that covers the trailing 32 bits (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to `/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L949)
|
|
222
|
+
- `to4in6(): string` — Return the v4-in-v6 form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L973)
|
|
223
|
+
- `inspectTeredo(): TeredoProperties` — Decodes the Teredo tunneling fields embedded in this address. Returns the Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, UDP port, and Microsoft-format flag breakdown (reserved, universal/local, group/individual, nonce). Only meaningful for addresses in `2001::/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L994)
|
|
224
|
+
- `inspect6to4(): SixToFourProperties` — Decodes the 6to4 tunneling fields embedded in this address. Returns the 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for addresses in `2002::/16`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1057)
|
|
225
|
+
- `to6to4(): Address6 | null` — Return a v6 6to4 address from a v6 v4inv6 address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1077)
|
|
226
|
+
- `toAddress4Nat64(prefix?: string): Address4 | null` — Extract the embedded IPv4 address from a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. Returns `null` if this address is not contained within the given prefix. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1146)
|
|
227
|
+
- `toByteArray(): number[]` — Return a byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1181)
|
|
228
|
+
- `toUnsignedByteArray(): number[]` — Return an unsigned byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1200)
|
|
229
|
+
- `isCanonical(): boolean` — Returns true if the address is in the canonical form, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1278)
|
|
230
|
+
- `isLinkLocal(): boolean` — Returns true if the address is a link-local unicast address in `fe80::/10` ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4)) or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1289)
|
|
231
|
+
- `isMulticast(): boolean` — Returns true if the address is a multicast address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1302)
|
|
232
|
+
- `is4(): boolean` — Returns true if the address was written in v4-in-v6 dotted-quad notation (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag and does not reflect whether the address bits lie in the IPv4-mapped (`::ffff:0:0/96`) subnet — for that, see isMapped4. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1319)
|
|
233
|
+
- `isMapped4(): boolean` — Returns true if the address is an IPv4-mapped IPv6 address in `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), false otherwise. Unlike is4, this checks the underlying address bits rather than the textual notation, so `::ffff:127.0.0.1` and `::ffff:7f00:1` both return true. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1331)
|
|
234
|
+
- `embeddedIPv4(): Address4 | null` — If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that embedded address as an Address4; otherwise return null. The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and delegate to the embedded Address4 when present, so a literal such as `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). This matters wherever the checks back a trust-boundary decision (e.g. an SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as non-internal. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1352)
|
|
235
|
+
- `isTeredo(): boolean` — Returns true if the address is a Teredo address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1364)
|
|
236
|
+
- `is6to4(): boolean` — Returns true if the address is a 6to4 address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1372)
|
|
237
|
+
- `isLoopback(): boolean` — Returns true if the address is a loopback address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1380)
|
|
238
|
+
- `isULA(): boolean` — Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1393)
|
|
239
|
+
- `isPrivate(): boolean` — Returns true if the address is private, i.e. a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an address in the NAT64 local-use range `64:ff9b:1::/48` ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to Address4.isPrivate; use it instead of isULA when you need to catch mapped RFC 1918 addresses as well as native ULAs. The local-use NAT64 range is reported private as a whole rather than by its embedded IPv4 address: an operator may carve a prefix of any RFC 6052 length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4 addresses under different deployments and no single decoding is correct. Use toAddress4Nat64 with the deployment's prefix to decode one. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1415)
|
|
240
|
+
- `isCGNAT(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false otherwise. There is no native IPv6 CGNAT range, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1432)
|
|
241
|
+
- `isBroadcast(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. There is no IPv6 broadcast, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:255.255.255.255`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1449)
|
|
242
|
+
- `isUnspecified(): boolean` — Returns true if the address is the unspecified address `::`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1462)
|
|
243
|
+
- `isDocumentation(): boolean` — Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1475)
|
|
244
|
+
- `isBenchmarking(): boolean` — Returns true if the address is in the benchmarking range `2001:2::/48` ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in `198.18.0.0/15`, false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1486)
|
|
245
|
+
- `isGlobal(): boolean` — Returns true if the address is globally reachable: inside the global unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns for global unicast; everything else is reserved, ULA, link-local, or multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/) marks as not globally reachable. An IPv4-mapped or NAT64 well-known address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4 (`2002::/16`) are not global either: the registry lists them as N/A and a packet to one needs a relay. This covers everything the individual classifiers name and the blocks they do not: the discard-only prefix `100::/64`, the IETF protocol assignments in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible `::/96` ranges, and unallocated space such as `4000::/3`. It is the single predicate to use where a request must not reach an internal or special-purpose destination; see SECURITY.md. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1515)
|
|
246
|
+
- `href(optionalPort?: string | number): string` — Returns the address as an HTTP URL with the host bracketed, e.g. `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, e.g. `http://[2001:db8::1]:8080/`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1534)
|
|
247
|
+
- `link(options?: { className?: string; prefix?: string; v4?: boolean }): string` — Returns an HTML `<a>` element whose `href` encodes the address in a URL hash fragment (default prefix `/#address=`). Useful for linking between pages of an address-inspector UI. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1552)
|
|
248
|
+
- `group(): string` — Groups an address. Returns an HTML fragment: each group is wrapped in a `<span>` carrying the group classes an address-inspector UI hovers on. The address content is HTML-escaped; anything you concatenate around it is your responsibility. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1597)
|
|
249
|
+
- `regularExpressionString(substringSearch?: boolean): string` — Generate a regular expression string that can be used to find or validate all variations of this address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1649)
|
|
250
|
+
- `regularExpression(substringSearch?: boolean): RegExp` — Generate a regular expression that can be used to find or validate all variations of this address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1703)
|
|
251
|
+
|
|
252
|
+
**Properties**
|
|
253
|
+
|
|
254
|
+
- `address4: Address4` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L97)
|
|
255
|
+
- `address: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L98)
|
|
256
|
+
- `addressMinusSuffix: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L99)
|
|
257
|
+
- `elidedGroups: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L100)
|
|
258
|
+
- `elisionBegin: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L101)
|
|
259
|
+
- `elisionEnd: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L102)
|
|
260
|
+
- `groups: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L103)
|
|
261
|
+
- `parsedAddress4: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L104)
|
|
262
|
+
- `parsedAddress: string[]` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L105)
|
|
263
|
+
- `parsedSubnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L106)
|
|
264
|
+
- `subnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L107)
|
|
265
|
+
- `subnetMask: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L108)
|
|
266
|
+
- `v4: boolean` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L109)
|
|
267
|
+
- `zone: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L110)
|
|
268
|
+
- `isInSubnet: (address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1256)
|
|
269
|
+
- `isHostInSubnet: (address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. Prefer this over `isInSubnet` when classifying a single address, so the answer doesn't change with the CIDR suffix the caller happened to write — notably when the address came from untrusted input and the result backs a trust-boundary decision. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1266)
|
|
270
|
+
- `isCorrect: () => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1272)
|
|
271
|
+
|
|
272
|
+
</details>
|
|
273
|
+
|
|
274
|
+
<details>
|
|
275
|
+
<summary><a id="addresserror"></a><strong>AddressError</strong></summary>
|
|
276
|
+
|
|
277
|
+
**Constructor**
|
|
278
|
+
|
|
279
|
+
- `new AddressError(message: string, parseMessage?: string): AddressError`
|
|
280
|
+
|
|
281
|
+
**Properties**
|
|
282
|
+
|
|
283
|
+
- `parseMessage: string` — The offending address with the portion that failed to parse wrapped in `<span class="parse-error">`, e.g. `2001:db8<span class="parse-error">:::</span>1`. Present only on errors thrown from a parse path that can point at a specific substring. This is an HTML fragment intended for an address-inspector UI. The address content is HTML-escaped, so it is safe to insert as-is; treat it as markup rather than as a plain-text message, and use `message` for anything that renders as text. [src](https://github.com/beaugunderson/ip-address/blob/main/src/address-error.ts#L13)
|
|
284
|
+
|
|
285
|
+
</details>
|
|
286
|
+
|
|
287
|
+
<!-- API:END -->
|
|
288
|
+
|
|
289
|
+
### Security
|
|
290
|
+
|
|
291
|
+
Vulnerabilities go through [GitHub's private vulnerability reporting](https://github.com/beaugunderson/ip-address/security/advisories/new); [SECURITY.md](./SECURITY.md) has the scope and what to expect. Confirmed issues get a fix, a release, and a public [advisory](https://github.com/beaugunderson/ip-address/security/advisories) with a CVE, rather than a quiet patch.
|
|
292
|
+
|
|
293
|
+
Releases are built and published by CI through npm trusted publishing. Every version from 10.2.1 onward carries a provenance attestation tying the tarball to the commit and workflow that built it. Check it with `npm audit signatures`.
|
|
294
|
+
|
|
295
|
+
If you are using the address-property checks as a security control, read [that section of SECURITY.md](./SECURITY.md#classifiers-are-not-an-ssrf-defense) first. `isPrivate()`, `isLoopback()`, `isInSubnet()` and their siblings classify an address that has already been parsed, which makes them one layer of an SSRF guard rather than the whole of it. A hostname that resolves to an internal address, a DNS record that changes after your check, or a redirect will all sail past a guard built only on them. Within that layer, use `isGlobal()` rather than an OR of the named classifiers: it is false for every block the IANA special-purpose registries mark as not globally reachable, including the ones with no classifier of their own.
|
|
296
|
+
|
|
297
|
+
### Used by
|
|
298
|
+
|
|
299
|
+
`ip-address` is downloaded ~86 million times per week, mostly via the Node proxy/agent ecosystem. The dependency chain runs through a handful of widely-used packages:
|
|
300
|
+
|
|
301
|
+
- [**socks**](https://github.com/JoshGlazebrook/socks) (~53M weekly) — SOCKS4/5 client for Node; depends on `ip-address` directly. The single biggest source of downloads.
|
|
302
|
+
- [**socks-proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/socks-proxy-agent) (~55M weekly) — `http.Agent` for SOCKS proxies; depends on `socks`. Bundled by virtually every CLI that respects `HTTPS_PROXY`.
|
|
303
|
+
- [**npm**](https://github.com/npm/cli) and [**pnpm**](https://github.com/pnpm/pnpm) — both bundle `socks-proxy-agent` through their HTTP fetch stack (`make-fetch-happen` → `@npmcli/agent`), so every Node install on the planet pulls in `ip-address` as a transitive dependency.
|
|
304
|
+
- [**Puppeteer**](https://github.com/puppeteer/puppeteer) — `@puppeteer/browsers` uses `proxy-agent` for browser-binary downloads, which routes through `socks-proxy-agent` → `socks` → `ip-address`.
|
|
305
|
+
- [**proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/proxy-agent) (~28M weekly) and [**pac-proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/pac-proxy-agent) (~27M weekly) — auto-detecting proxy agents (HTTP/HTTPS/SOCKS/PAC) used widely in scraping, headless-browser, and CI tooling.
|
|
306
|
+
- [**cacache**](https://github.com/npm/cacache) (~40M weekly) — npm's content-addressable cache; pulls in the same fetch stack.
|
|
307
|
+
|
|
308
|
+
Beyond the proxy chain, `ip-address` has been used by Juniper Networks' Contrail, Ably's proxy-protocol implementation, Rackspace's serialization framework, IPFS, and the [SwitchyOmega](https://github.com/FelisCatus/SwitchyOmega) Chrome extension, among many others.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class AddressError extends Error {
|
|
2
|
+
/**
|
|
3
|
+
* The offending address with the portion that failed to parse wrapped in
|
|
4
|
+
* `<span class="parse-error">`, e.g. `2001:db8<span
|
|
5
|
+
* class="parse-error">:::</span>1`. Present only on errors thrown from a
|
|
6
|
+
* parse path that can point at a specific substring.
|
|
7
|
+
*
|
|
8
|
+
* This is an HTML fragment intended for an address-inspector UI. The
|
|
9
|
+
* address content is HTML-escaped, so it is safe to insert as-is; treat it
|
|
10
|
+
* as markup rather than as a plain-text message, and use `message` for
|
|
11
|
+
* anything that renders as text.
|
|
12
|
+
*/
|
|
13
|
+
parseMessage?: string;
|
|
14
|
+
constructor(message: string, parseMessage?: string);
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressError = void 0;
|
|
4
|
+
class AddressError extends Error {
|
|
5
|
+
constructor(message, parseMessage) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'AddressError';
|
|
8
|
+
this.parseMessage = parseMessage;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AddressError = AddressError;
|
|
12
|
+
//# sourceMappingURL=address-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-error.js","sourceRoot":"","sources":["../src/address-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IAcrC,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AArBD,oCAqBC","sourcesContent":["export class AddressError extends Error {\n /**\n * The offending address with the portion that failed to parse wrapped in\n * `<span class=\"parse-error\">`, e.g. `2001:db8<span\n * class=\"parse-error\">:::</span>1`. Present only on errors thrown from a\n * parse path that can point at a specific substring.\n *\n * This is an HTML fragment intended for an address-inspector UI. The\n * address content is HTML-escaped, so it is safe to insert as-is; treat it\n * as markup rather than as a plain-text message, and use `message` for\n * anything that renders as text.\n */\n parseMessage?: string;\n\n constructor(message: string, parseMessage?: string) {\n super(message);\n\n this.name = 'AddressError';\n\n this.parseMessage = parseMessage;\n }\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Address4 } from './ipv4';
|
|
2
|
+
import { Address6 } from './ipv6';
|
|
3
|
+
export interface ReverseFormOptions {
|
|
4
|
+
omitSuffix?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns whether this address's *network* is contained within `address`,
|
|
8
|
+
* i.e. whether every address this one can represent also falls inside
|
|
9
|
+
* `address`. A network wider than `address` is not contained in it, so
|
|
10
|
+
* `10.0.0.0/8` is not in `10.0.0.0/16`.
|
|
11
|
+
*
|
|
12
|
+
* To ask whether the address itself falls inside a range, ignoring any CIDR
|
|
13
|
+
* suffix it was written with, use {@link isHostInSubnet} instead. That is the
|
|
14
|
+
* question the special-use classifiers ask.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isInSubnet(this: Address4 | Address6, address: Address4 | Address6): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether this address's host bits fall inside `address`, ignoring
|
|
19
|
+
* this address's own subnet mask.
|
|
20
|
+
*
|
|
21
|
+
* This is the primitive the special-use classifiers (`isLoopback`,
|
|
22
|
+
* `isPrivate`, `isLinkLocal`, `getType`, …) are built on: they answer a
|
|
23
|
+
* question about the address, so the answer must not change with the CIDR
|
|
24
|
+
* suffix the caller happened to write. Use this rather than
|
|
25
|
+
* {@link isInSubnet} when classifying a single address — notably when the
|
|
26
|
+
* address came from untrusted input and the result backs a trust-boundary
|
|
27
|
+
* decision such as an SSRF allow/deny filter.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isHostInSubnet(this: Address4 | Address6, address: Address4 | Address6): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* One parsed row of an IANA special-purpose address registry: the block, and
|
|
32
|
+
* whether the registry marks it globally reachable (`null` when the column is
|
|
33
|
+
* blank, in which case the containing block answers).
|
|
34
|
+
*/
|
|
35
|
+
export interface SpecialPurposeEntry<A extends Address4 | Address6> {
|
|
36
|
+
subnet: A;
|
|
37
|
+
reachable: boolean | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns whether the registry marks this address globally reachable: the
|
|
41
|
+
* answer of the most specific entry containing it that has one, or `true`
|
|
42
|
+
* when no entry contains it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isGloballyReachable<A extends Address4 | Address6>(this: A, entries: ReadonlyArray<SpecialPurposeEntry<A>>): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Adds `n` to `value` and returns the result, throwing `AddressError` unless
|
|
47
|
+
* `n` is an integer and the result stays within `[0, 2**bits - 1]`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function offsetBigInt(value: bigint, n: number | bigint, bits: number, family: string): bigint;
|
|
50
|
+
export declare function isCorrect(defaultBits: number): (this: Address4 | Address6) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the prefix length (number of leading 1 bits) of a contiguous
|
|
53
|
+
* subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
|
|
54
|
+
* `255.0.255.0`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function prefixLengthFromMask(value: bigint, totalBits: number): number;
|
|
57
|
+
/**
|
|
58
|
+
* Throws `AddressError` unless `bytes` holds exactly `byteCount` integers,
|
|
59
|
+
* each from `minimum` to 255. Pass a `minimum` of `-128` where signed bytes
|
|
60
|
+
* are accepted and folded to unsigned, and `0` where they are not.
|
|
61
|
+
*/
|
|
62
|
+
export declare function assertByteArray(bytes: number[], byteCount: number, family: 'IPv4' | 'IPv6', minimum: number): void;
|
|
63
|
+
export declare function numberToPaddedHex(number: number): string;
|
|
64
|
+
export declare function stringToPaddedHex(numberString: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* @param binaryValue Binary representation of a value (e.g. `10`)
|
|
67
|
+
* @param position Byte position, where 0 is the least significant bit
|
|
68
|
+
*/
|
|
69
|
+
export declare function testBit(binaryValue: string, position: number): boolean;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isInSubnet = isInSubnet;
|
|
4
|
+
exports.isHostInSubnet = isHostInSubnet;
|
|
5
|
+
exports.isGloballyReachable = isGloballyReachable;
|
|
6
|
+
exports.offsetBigInt = offsetBigInt;
|
|
7
|
+
exports.isCorrect = isCorrect;
|
|
8
|
+
exports.prefixLengthFromMask = prefixLengthFromMask;
|
|
9
|
+
exports.assertByteArray = assertByteArray;
|
|
10
|
+
exports.numberToPaddedHex = numberToPaddedHex;
|
|
11
|
+
exports.stringToPaddedHex = stringToPaddedHex;
|
|
12
|
+
exports.testBit = testBit;
|
|
13
|
+
const address_error_1 = require("./address-error");
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether this address's *network* is contained within `address`,
|
|
16
|
+
* i.e. whether every address this one can represent also falls inside
|
|
17
|
+
* `address`. A network wider than `address` is not contained in it, so
|
|
18
|
+
* `10.0.0.0/8` is not in `10.0.0.0/16`.
|
|
19
|
+
*
|
|
20
|
+
* To ask whether the address itself falls inside a range, ignoring any CIDR
|
|
21
|
+
* suffix it was written with, use {@link isHostInSubnet} instead. That is the
|
|
22
|
+
* question the special-use classifiers ask.
|
|
23
|
+
*/
|
|
24
|
+
function isInSubnet(address) {
|
|
25
|
+
if (this.subnetMask < address.subnetMask) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return isHostInSubnet.call(this, address);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether this address's host bits fall inside `address`, ignoring
|
|
32
|
+
* this address's own subnet mask.
|
|
33
|
+
*
|
|
34
|
+
* This is the primitive the special-use classifiers (`isLoopback`,
|
|
35
|
+
* `isPrivate`, `isLinkLocal`, `getType`, …) are built on: they answer a
|
|
36
|
+
* question about the address, so the answer must not change with the CIDR
|
|
37
|
+
* suffix the caller happened to write. Use this rather than
|
|
38
|
+
* {@link isInSubnet} when classifying a single address — notably when the
|
|
39
|
+
* address came from untrusted input and the result backs a trust-boundary
|
|
40
|
+
* decision such as an SSRF allow/deny filter.
|
|
41
|
+
*/
|
|
42
|
+
function isHostInSubnet(address) {
|
|
43
|
+
return this.mask(address.subnetMask) === address.mask();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether the registry marks this address globally reachable: the
|
|
47
|
+
* answer of the most specific entry containing it that has one, or `true`
|
|
48
|
+
* when no entry contains it.
|
|
49
|
+
*/
|
|
50
|
+
function isGloballyReachable(entries) {
|
|
51
|
+
let best = null;
|
|
52
|
+
for (let i = 0; i < entries.length; i++) {
|
|
53
|
+
const entry = entries[i];
|
|
54
|
+
if (entry.reachable !== null &&
|
|
55
|
+
isHostInSubnet.call(this, entry.subnet) &&
|
|
56
|
+
(best === null || entry.subnet.subnetMask > best.subnet.subnetMask)) {
|
|
57
|
+
best = entry;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return best === null ? true : best.reachable;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Adds `n` to `value` and returns the result, throwing `AddressError` unless
|
|
64
|
+
* `n` is an integer and the result stays within `[0, 2**bits - 1]`.
|
|
65
|
+
*/
|
|
66
|
+
function offsetBigInt(value, n, bits, family) {
|
|
67
|
+
if (typeof n === 'number' && !Number.isSafeInteger(n)) {
|
|
68
|
+
throw new address_error_1.AddressError(`${family} offset must be an integer`);
|
|
69
|
+
}
|
|
70
|
+
if (typeof n !== 'number' && typeof n !== 'bigint') {
|
|
71
|
+
throw new address_error_1.AddressError(`${family} offset must be an integer`);
|
|
72
|
+
}
|
|
73
|
+
const result = value + BigInt(n);
|
|
74
|
+
if (result < BigInt(0) || result > (BigInt(1) << BigInt(bits)) - BigInt(1)) {
|
|
75
|
+
throw new address_error_1.AddressError(`${family} offset leaves the address space`);
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function isCorrect(defaultBits) {
|
|
80
|
+
return function isCorrectForm() {
|
|
81
|
+
if (this.addressMinusSuffix !== this.correctForm()) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (this.subnetMask === defaultBits && !this.parsedSubnet) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return this.parsedSubnet === String(this.subnetMask);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns the prefix length (number of leading 1 bits) of a contiguous
|
|
92
|
+
* subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
|
|
93
|
+
* `255.0.255.0`).
|
|
94
|
+
*/
|
|
95
|
+
function prefixLengthFromMask(value, totalBits) {
|
|
96
|
+
const binary = value.toString(2).padStart(totalBits, '0');
|
|
97
|
+
if (binary.length > totalBits) {
|
|
98
|
+
throw new address_error_1.AddressError('Invalid subnet mask.');
|
|
99
|
+
}
|
|
100
|
+
const firstZero = binary.indexOf('0');
|
|
101
|
+
if (firstZero === -1) {
|
|
102
|
+
return totalBits;
|
|
103
|
+
}
|
|
104
|
+
if (binary.slice(firstZero).includes('1')) {
|
|
105
|
+
throw new address_error_1.AddressError('Invalid subnet mask.');
|
|
106
|
+
}
|
|
107
|
+
return firstZero;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Throws `AddressError` unless `bytes` holds exactly `byteCount` integers,
|
|
111
|
+
* each from `minimum` to 255. Pass a `minimum` of `-128` where signed bytes
|
|
112
|
+
* are accepted and folded to unsigned, and `0` where they are not.
|
|
113
|
+
*/
|
|
114
|
+
function assertByteArray(bytes, byteCount, family, minimum) {
|
|
115
|
+
if (bytes.length !== byteCount) {
|
|
116
|
+
throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`);
|
|
117
|
+
}
|
|
118
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
119
|
+
if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) {
|
|
120
|
+
throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function numberToPaddedHex(number) {
|
|
125
|
+
return number.toString(16).padStart(2, '0');
|
|
126
|
+
}
|
|
127
|
+
function stringToPaddedHex(numberString) {
|
|
128
|
+
return numberToPaddedHex(parseInt(numberString, 10));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @param binaryValue Binary representation of a value (e.g. `10`)
|
|
132
|
+
* @param position Byte position, where 0 is the least significant bit
|
|
133
|
+
*/
|
|
134
|
+
function testBit(binaryValue, position) {
|
|
135
|
+
const { length } = binaryValue;
|
|
136
|
+
if (position > length) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
const positionInString = length - position;
|
|
140
|
+
return binaryValue.substring(positionInString, positionInString + 1) === '1';
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=common.js.map
|