|
21 | 21 | / for logging with asterisks. If true, the plain-text password will be logged
|
22 | 22 | .ipc.cfg.logPasswordsDuringConnect:0b;
|
23 | 23 |
|
| 24 | +/ If enabled, any connection attempt that is made to a process on the local server will be re-routed via Unix Domain Sockets |
| 25 | +/ rather than localhost TCP (only on supported Operating Systems) |
| 26 | +.ipc.cfg.forceUnixDomainSocketsForLocalhost:1b; |
| 27 | + |
24 | 28 |
|
25 | 29 | / Provides current state of all connections that were initiated by an external process. This will
|
26 | 30 | / only be populated if .ipc.cfg.enableInboundConnTracking is enabled on library initialisation
|
|
33 | 37 | / @see .ipc.connectWithTimeout
|
34 | 38 | .ipc.outbound:`handle xkey flip `handle`targetHostPort`connectTime!"ISP"$\:();
|
35 | 39 |
|
| 40 | +/ The Operating Systems that support Unix Domain Sockets |
| 41 | +.ipc.udsSupportedOs:`l`v`m; |
| 42 | + |
| 43 | +/ List of host names / IP addresses that are always classified as 'local' and therefore should default to UDS if enabled |
| 44 | +/ On library initialisation, additional hosts are added |
| 45 | +.ipc.localhostAddresses:`localhost`127.0.0.1; |
| 46 | + |
| 47 | +/ Combination of '.ipc.cfg.forceUnixDomainSocketsForLocalhost' and if the current OS supports UDS |
| 48 | +/ @see .ipc.init |
| 49 | +.ipc.udsEnabled:0b; |
| 50 | + |
36 | 51 |
|
37 | 52 | .ipc.init:{
|
38 | 53 | if[.ipc.cfg.enableInboundConnTracking;
|
39 | 54 | .ipc.i.enableInboundConnTracking[];
|
40 | 55 | ];
|
| 56 | + |
| 57 | + .ipc.localhostAddresses:.ipc.localhostAddresses union .z.h,.Q.host[.z.a],.convert.ipOctalToSymbol each (.z.a; .Q.addr .z.h); |
| 58 | + .log.if.debug ("Local host names and IP addresses: {}"; .ipc.localhostAddresses); |
| 59 | + |
| 60 | + .ipc.udsEnabled:.ipc.cfg.forceUnixDomainSocketsForLocalhost & (`$first string .z.o) in .ipc.udsSupportedOs; |
| 61 | + |
| 62 | + .log.if.info ("IPC library initialised [ UDS Enabled: {} ]"; `no`yes .ipc.udsEnabled); |
41 | 63 | };
|
42 | 64 |
|
43 | 65 |
|
|
89 | 111 | 0 > timeout;
|
90 | 112 | '"IllegalArgumentException"
|
91 | 113 | ];
|
92 |
| - |
| 114 | + |
93 | 115 | hostPort:.type.ensureHostPortSymbol hostPort;
|
94 | 116 |
|
| 117 | + if[.ipc.udsEnabled; |
| 118 | + hpSplit:":" vs string hostPort; |
| 119 | + host:`localhost^`$hpSplit 1; |
| 120 | + |
| 121 | + if[host in .ipc.localhostAddresses; |
| 122 | + udsHostPort:`$":unix://",":" sv 2_ hpSplit; |
| 123 | + ]; |
| 124 | + |
| 125 | + if[0 < count udsHostPort; |
| 126 | + .log.if.debug ("Host/port translated to Unix Domain Socket [ Original: {} ] [ Now: {} ]"; hostPort; udsHostPort); |
| 127 | + hostPort:udsHostPort; |
| 128 | + ]; |
| 129 | + ]; |
| 130 | + |
95 | 131 | logHostPort:string hostPort;
|
96 | 132 | logTimeout:$[timeout in 0 0Wi; "waiting indefinitely"; "timeout ",string[timeout]," ms"];
|
97 | 133 |
|
|
0 commit comments