* Parse address string into components. * Handles both URL-style ("tcp://host:port") and unix socket paths ("/tmp/sock").
(str)
| 16 | * Handles both URL-style ("tcp://host:port") and unix socket paths ("/tmp/sock"). |
| 17 | */ |
| 18 | function parseAddr(str) { |
| 19 | try { |
| 20 | var u = new URL(str); |
| 21 | if (u.protocol === 'unix:') { |
| 22 | return { pathname: u.pathname, hostname: null, port: null }; |
| 23 | } |
| 24 | return { hostname: u.hostname, port: u.port, pathname: null }; |
| 25 | } catch(e) { |
| 26 | return { pathname: str, hostname: null, port: null }; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Errors to ignore. |
no outgoing calls
no test coverage detected
searching dependent graphs…