(tp)
| 40 | Request.instanceProperties = new Set(['id', 'params', 'raw', 'query', 'log', 'body']) |
| 41 | |
| 42 | function getTrustProxyFn (tp) { |
| 43 | if (typeof tp === 'function') { |
| 44 | return tp |
| 45 | } |
| 46 | if (tp === true) { |
| 47 | // Support trusting everything |
| 48 | return function () { return true } |
| 49 | } |
| 50 | if (typeof tp === 'number') { |
| 51 | // Support trusting hop count |
| 52 | return function (a, i) { return i < tp } |
| 53 | } |
| 54 | if (typeof tp === 'string') { |
| 55 | // Support comma-separated tps |
| 56 | const values = tp.split(',').map(it => it.trim()) |
| 57 | return proxyAddr.compile(values) |
| 58 | } |
| 59 | return proxyAddr.compile(tp) |
| 60 | } |
| 61 | |
| 62 | function buildRequest (R, trustProxy) { |
| 63 | if (trustProxy) { |
no outgoing calls
no test coverage detected