@arcjet/ip
Advanced tools
Comparing version 1.0.0-alpha.12 to 1.0.0-alpha.13
12
index.js
@@ -111,3 +111,3 @@ function parseXForwardedFor(value) { | ||
const hasLeadingZero = p.peakChar() === "0"; | ||
let nextCharAsDigit = () => { | ||
function nextCharAsDigit() { | ||
return p.readAtomically((p) => { | ||
@@ -122,3 +122,3 @@ const c = p.readChar(); | ||
}); | ||
}; | ||
} | ||
for (let digit = nextCharAsDigit(); digit !== undefined; digit = nextCharAsDigit()) { | ||
@@ -177,3 +177,3 @@ result = result * radix; | ||
if (isIPv4Tuple(ipv4)) { | ||
let [one, two, three, four] = ipv4; | ||
const [one, two, three, four] = ipv4; | ||
groups[i + 0] = u16FromBytes([one, two]); | ||
@@ -513,2 +513,8 @@ groups[i + 1] = u16FromBytes([three, four]); | ||
} | ||
// Fly.io | ||
// Fly-Client-IP: https://fly.io/docs/networking/request-headers/#fly-client-ip | ||
const flyClientIP = headers.get("fly-client-ip"); | ||
if (isGlobalIP(flyClientIP)) { | ||
return flyClientIP; | ||
} | ||
// Default nginx proxy/fcgi; alternative to x-forwarded-for, used by some proxies | ||
@@ -515,0 +521,0 @@ // X-Real-IP |
13
index.ts
@@ -137,3 +137,3 @@ function parseXForwardedFor(value?: string | null): string[] { | ||
let nextCharAsDigit = () => { | ||
function nextCharAsDigit() { | ||
return p.readAtomically((p) => { | ||
@@ -148,3 +148,3 @@ const c = p.readChar(); | ||
}); | ||
}; | ||
} | ||
@@ -210,3 +210,3 @@ for ( | ||
if (isIPv4Tuple(ipv4)) { | ||
let [one, two, three, four] = ipv4; | ||
const [one, two, three, four] = ipv4; | ||
groups[i + 0] = u16FromBytes([one, two]); | ||
@@ -643,2 +643,9 @@ groups[i + 1] = u16FromBytes([three, four]); | ||
// Fly.io | ||
// Fly-Client-IP: https://fly.io/docs/networking/request-headers/#fly-client-ip | ||
const flyClientIP = headers.get("fly-client-ip"); | ||
if (isGlobalIP(flyClientIP)) { | ||
return flyClientIP; | ||
} | ||
// Default nginx proxy/fcgi; alternative to x-forwarded-for, used by some proxies | ||
@@ -645,0 +652,0 @@ // X-Real-IP |
{ | ||
"name": "@arcjet/ip", | ||
"version": "1.0.0-alpha.12", | ||
"version": "1.0.0-alpha.13", | ||
"description": "Arcjet utilities for finding the originating IP of a request", | ||
@@ -44,7 +44,7 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@arcjet/eslint-config": "1.0.0-alpha.12", | ||
"@arcjet/rollup-config": "1.0.0-alpha.12", | ||
"@arcjet/tsconfig": "1.0.0-alpha.12", | ||
"@arcjet/eslint-config": "1.0.0-alpha.13", | ||
"@arcjet/rollup-config": "1.0.0-alpha.13", | ||
"@arcjet/tsconfig": "1.0.0-alpha.13", | ||
"@jest/globals": "29.7.0", | ||
"@rollup/wasm-node": "4.14.3", | ||
"@rollup/wasm-node": "4.17.2", | ||
"@types/node": "18.18.0", | ||
@@ -51,0 +51,0 @@ "jest": "29.7.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56740
1191