Produced by Araxis Merge on 10/2/2017 1:40:07 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\express\node_modules\proxy-addr | README.md | Tue Jun 3 15:51:00 2014 UTC |
| 2 | chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\express\node_modules\proxy-addr | README.md | Mon Oct 2 12:57:04 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 246 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | # proxy-ad dr | |
| 2 | ||
| 3 | [](ht tp://badge .fury.io/j s/proxy-ad dr) | |
| 4 | []( https://tr avis-ci.or g/expressj s/proxy-ad dr) | |
| 5 | [](https: //coverall s.io/r/exp ressjs/pro xy-addr) | |
| 6 | ||
| 7 | Determine address of proxied r equest | |
| 8 | ||
| 9 | ## Install | |
| 10 | ||
| 11 | ```sh | |
| 12 | $ npm inst all proxy- addr | |
| 13 | ``` | |
| 14 | ||
| 15 | ## API | |
| 16 | ||
| 17 | ```js | |
| 18 | var proxya ddr = requ ire('proxy -addr') | |
| 19 | ``` | |
| 20 | ||
| 21 | ### proxya ddr(req, t rust) | |
| 22 | ||
| 23 | Return the address o f the requ est, using the given `trust` p arameter. | |
| 24 | ||
| 25 | The `trust ` argument is a func tion that returns `t rue` if yo u trust | |
| 26 | the addres s, `false` if you do n't. The c losest unt rusted add ress is | |
| 27 | returned. | |
| 28 | ||
| 29 | ```js | |
| 30 | proxyaddr( req, funct ion(addr){ return ad dr === '12 7.0.0.1' } ) | |
| 31 | proxyaddr( req, funct ion(addr, i){ return i < 1 }) | |
| 32 | ``` | |
| 33 | ||
| 34 | The `trust ` arugment may also be a singl e IP addre ss string or an | |
| 35 | array of t rusted add resses, as plain IP addresses, CIDR-form atted | |
| 36 | strings, o r IP/netma sk strings . | |
| 37 | ||
| 38 | ```js | |
| 39 | proxyaddr( req, '127. 0.0.1') | |
| 40 | proxyaddr( req, ['127 .0.0.0/8', '10.0.0.0 /8']) | |
| 41 | proxyaddr( req, ['127 .0.0.0/255 .0.0.0', ' 192.168.0. 0/255.255. 0.0']) | |
| 42 | ``` | |
| 43 | ||
| 44 | This modul e also sup ports IPv6 . Your IPv 6 addresse s will be normalized | |
| 45 | automatica lly (i.e. `fe80::00e d:1` equal s `fe80:0: 0:0:0:0:ed :1`). | |
| 46 | ||
| 47 | ```js | |
| 48 | proxyaddr( req, '::1' ) | |
| 49 | proxyaddr( req, ['::1 /128', 'fe 80::/10']) | |
| 50 | proxyaddr( req, ['fe8 0::/ffc0:: ']) | |
| 51 | ``` | |
| 52 | ||
| 53 | This modul e will aut omatically work with IPv4-mapp ed IPv6 ad dresses | |
| 54 | as well to support n ode.js in IPv6-only mode. This means tha t you do | |
| 55 | not have t o specify both `::ff ff:a00:1` and ` IP `. | |
| 56 | ||
| 57 | As a conve nience, th is module also takes certain p re-defined names | |
| 58 | in additio n to IP ad dresses, w hich expan d into IP addresses: | |
| 59 | ||
| 60 | ```js | |
| 61 | proxyaddr( req, 'loop back') | |
| 62 | proxyaddr( req, ['loo pback', 'f c00:ac:1ab 5:fff::1/6 4']) | |
| 63 | ``` | |
| 64 | ||
| 65 | * `loopb ack`: IPv4 and IPv6 loopback a ddresses ( like `::1` and | |
| 66 | `127.0 .0.1`). | |
| 67 | * `linkl ocal`: IPv 4 and IPv6 link-loca l addresse s (like | |
| 68 | `fe80: :1:1:1:1` and `169.2 54.0.1`). | |
| 69 | * `uniqu elocal`: I Pv4 privat e addresse s and IPv6 unique-lo cal | |
| 70 | addres ses (like `fc00:ac:1 ab5:fff::1 ` and `192 .168.0.1`) . | |
| 71 | ||
| 72 | When `trus t` is spec ified as a function, it will b e called f or each | |
| 73 | address to determine if it is a trusted address. T he functio n is | |
| 74 | given two arguments: `addr` an d `i`, whe re `addr` is a strin g of | |
| 75 | the addres s to check and `i` i s a number that repr esents the distance | |
| 76 | from the s ocket addr ess. | |
| 77 | ||
| 78 | ### proxya ddr.all(re q, [trust] ) | |
| 79 | ||
| 80 | Return all the addre sses of th e request, optionall y stopping at the | |
| 81 | first untr usted. Thi s array is ordered f rom closes t to furth est | |
| 82 | (i.e. `arr [0] === re q.connecti on.remoteA ddress`). | |
| 83 | ||
| 84 | ```js | |
| 85 | proxyaddr. all(req) | |
| 86 | ``` | |
| 87 | ||
| 88 | The option al `trust` argument takes the same argum ents as `t rust` | |
| 89 | does in `p roxyaddr(r eq, trust) `. | |
| 90 | ||
| 91 | ```js | |
| 92 | proxyaddr. all(req, ' loopback') | |
| 93 | ``` | |
| 94 | ||
| 95 | ### proxya ddr.compil e(val) | |
| 96 | ||
| 97 | Compiles a rgument `v al` into a `trust` f unction. T his functi on takes | |
| 98 | the same a rguments a s `trust` does in `p roxyaddr(r eq, trust) ` and | |
| 99 | returns a function s uitable fo r `proxyad dr(req, tr ust)`. | |
| 100 | ||
| 101 | ```js | |
| 102 | var trust = proxyadd r.compile( 'localhost ') | |
| 103 | var addr = proxyadd r(req, tru st) | |
| 104 | ``` | |
| 105 | ||
| 106 | This funct ion is mea nt to be o ptimized f or use aga inst every request. | |
| 107 | It is reco mmend to c ompile a t rust funct ion up-fro nt for the trusted | |
| 108 | configurat ion and pa ss that to `proxyadd r(req, tru st)` for e ach reques t. | |
| 109 | ||
| 110 | ## Testing | |
| 111 | ||
| 112 | ```sh | |
| 113 | $ npm test | |
| 114 | ``` | |
| 115 | ||
| 116 | ## Benchma rks | |
| 117 | ||
| 118 | ```sh | |
| 119 | $ npm run- script ben ch | |
| 120 | ``` | |
| 121 | ||
| 122 | ## License | |
| 123 | ||
| 124 | [MIT](LICE NSE) |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.