w-ipproxy 1.0.18 → 1.0.20

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.
@@ -19,19 +19,19 @@ function normalizeIp(v) {
19
19
  else if (s.split(':').length === 2) {
20
20
  s = s.split(':')[0]
21
21
  }
22
- let m = s.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i)
22
+ let m = s.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})(?::\d+)?$/i)
23
23
  if (m) {
24
24
  s = m[1]
25
25
  }
26
26
  return s
27
27
  }
28
28
 
29
- //檢查origin(可能為'ip1, ip2, ...')逐段正規化後是否含有指定IP
29
+ //檢查origin或標頭值('ip1, ip2', 'for=1.2.3.4;proto=https')內是否含有指定IP, 以IP可用字元之連續段切token後逐一正規化精確比對
30
30
  function originHasIp(origin, ip) {
31
31
  if (ip === '') {
32
32
  return false
33
33
  }
34
- return String(origin).split(',').map((v) => normalizeIp(v)).indexOf(ip) >= 0
34
+ return String(origin).split(/[^0-9a-fA-F:.[\]]+/).map((v) => normalizeIp(v)).indexOf(ip) >= 0
35
35
  }
36
36
 
37
37
 
@@ -16,11 +16,15 @@ rollupFiles({
16
16
  '@hapi/hapi': '@hapi/hapi',
17
17
  '@hapi/inert': '@hapi/inert',
18
18
  'https': 'https',
19
+ 'http': 'http',
20
+ 'net': 'net',
19
21
  },
20
22
  external: [
21
23
  '@hapi/hapi',
22
24
  '@hapi/inert',
23
25
  'https',
26
+ 'http',
27
+ 'net',
24
28
  ],
25
29
  })
26
30