@contember/engine-http 2.1.0-beta.2 → 2.1.0-rc.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"remoteAddress.d.ts","sourceRoot":"","sources":["../../../src/utils/remoteAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAyC3C,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAwBnF"}
1
+ {"version":3,"file":"remoteAddress.d.ts","sourceRoot":"","sources":["../../../src/utils/remoteAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AA2C3C,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAwBnF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/engine-http",
3
- "version": "2.1.0-beta.2",
3
+ "version": "2.1.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/production/index.js",
6
6
  "typings": "./dist/types/index.d.ts",
@@ -11,10 +11,12 @@ function isPrivate(ip: string): boolean {
11
11
 
12
12
  const r = addr.range()
13
13
  if (r === 'ipv4Mapped') {
14
- return (addr as ipaddr.IPv6).toIPv4Address().range() === 'private'
14
+ const mapped = (addr as ipaddr.IPv6).toIPv4Address().range()
15
+ return mapped === 'private' || mapped === 'loopback'
15
16
  }
16
17
 
17
18
  return r === 'private' // IPv4 RFC1918
19
+ || r === 'loopback' // 127.0.0.0/8, ::1
18
20
  || r === 'uniqueLocal' // IPv6 fc00::/7
19
21
  || r === 'linkLocal' // IPv6 fe80::/10
20
22
  }