@journeyapps/https-proxy-socket 0.2.2 → 1.0.0

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.
Files changed (72) hide show
  1. package/README.md +105 -51
  2. package/lib/{HttpsProxySocket.d.ts → cjs/HttpsProxySocket.d.ts} +6 -6
  3. package/lib/cjs/HttpsProxySocket.d.ts.map +1 -0
  4. package/lib/{HttpsProxySocket.js → cjs/HttpsProxySocket.js} +64 -33
  5. package/lib/cjs/HttpsProxySocket.js.map +1 -0
  6. package/lib/cjs/ProxyAgent.d.ts +11 -0
  7. package/lib/cjs/ProxyAgent.d.ts.map +1 -0
  8. package/lib/cjs/ProxyAgent.js +67 -0
  9. package/lib/cjs/ProxyAgent.js.map +1 -0
  10. package/lib/cjs/bin/mongoReplicas.d.ts +3 -0
  11. package/lib/cjs/bin/mongoReplicas.d.ts.map +1 -0
  12. package/lib/cjs/bin/mongoReplicas.js +26 -0
  13. package/lib/cjs/bin/mongoReplicas.js.map +1 -0
  14. package/lib/cjs/createProxyAgent.d.ts +11 -0
  15. package/lib/cjs/createProxyAgent.d.ts.map +1 -0
  16. package/lib/cjs/createProxyAgent.js +14 -0
  17. package/lib/cjs/createProxyAgent.js.map +1 -0
  18. package/lib/cjs/index.d.ts +3 -0
  19. package/lib/cjs/index.d.ts.map +1 -0
  20. package/lib/cjs/index.js +19 -0
  21. package/lib/cjs/index.js.map +1 -0
  22. package/lib/cjs/mongoPatch.d.ts +16 -0
  23. package/lib/cjs/mongoPatch.d.ts.map +1 -0
  24. package/lib/cjs/mongoPatch.js +58 -0
  25. package/lib/cjs/mongoPatch.js.map +1 -0
  26. package/lib/cjs/utils/parseOptions.d.ts +3 -0
  27. package/lib/cjs/utils/parseOptions.d.ts.map +1 -0
  28. package/lib/cjs/utils/parseOptions.js +16 -0
  29. package/lib/cjs/utils/parseOptions.js.map +1 -0
  30. package/lib/cjs/utils/setServername.d.ts +3 -0
  31. package/lib/cjs/utils/setServername.d.ts.map +1 -0
  32. package/lib/cjs/utils/setServername.js +47 -0
  33. package/lib/cjs/utils/setServername.js.map +1 -0
  34. package/lib/esm/HttpsProxySocket.d.ts +42 -0
  35. package/lib/esm/HttpsProxySocket.d.ts.map +1 -0
  36. package/lib/esm/HttpsProxySocket.js +197 -0
  37. package/lib/esm/HttpsProxySocket.js.map +1 -0
  38. package/lib/esm/ProxyAgent.d.ts +11 -0
  39. package/lib/esm/ProxyAgent.d.ts.map +1 -0
  40. package/lib/esm/ProxyAgent.js +67 -0
  41. package/lib/esm/ProxyAgent.js.map +1 -0
  42. package/lib/esm/bin/mongoReplicas.d.ts +3 -0
  43. package/lib/esm/bin/mongoReplicas.d.ts.map +1 -0
  44. package/lib/esm/bin/mongoReplicas.js +26 -0
  45. package/lib/esm/bin/mongoReplicas.js.map +1 -0
  46. package/lib/esm/createProxyAgent.d.ts +11 -0
  47. package/lib/esm/createProxyAgent.d.ts.map +1 -0
  48. package/lib/esm/createProxyAgent.js +14 -0
  49. package/lib/esm/createProxyAgent.js.map +1 -0
  50. package/lib/esm/index.d.ts +3 -0
  51. package/lib/esm/index.d.ts.map +1 -0
  52. package/lib/esm/index.js +19 -0
  53. package/lib/esm/index.js.map +1 -0
  54. package/lib/esm/mongoPatch.d.ts +16 -0
  55. package/lib/esm/mongoPatch.d.ts.map +1 -0
  56. package/lib/esm/mongoPatch.js +58 -0
  57. package/lib/esm/mongoPatch.js.map +1 -0
  58. package/lib/esm/utils/parseOptions.d.ts +3 -0
  59. package/lib/esm/utils/parseOptions.d.ts.map +1 -0
  60. package/lib/esm/utils/parseOptions.js +16 -0
  61. package/lib/esm/utils/parseOptions.js.map +1 -0
  62. package/lib/esm/utils/setServername.d.ts +3 -0
  63. package/lib/esm/utils/setServername.d.ts.map +1 -0
  64. package/lib/esm/utils/setServername.js +47 -0
  65. package/lib/esm/utils/setServername.js.map +1 -0
  66. package/package.json +39 -21
  67. package/lib/index.d.ts +0 -2
  68. package/lib/index.js +0 -7
  69. package/lib/proxyAgent.d.ts +0 -11
  70. package/lib/proxyAgent.js +0 -43
  71. package/lib/tediousPatch.d.ts +0 -8
  72. package/lib/tediousPatch.js +0 -34
package/README.md CHANGED
@@ -5,61 +5,115 @@ Node library to enable opening Socket connections via an HTTPS proxy.
5
5
  Based on the implementation in https://github.com/TooTallNate/node-https-proxy-agent,
6
6
  but adapted to expose raw Sockets, instead of just http/https requests.
7
7
 
8
- ## Installation
8
+ ## Proxy for Node mssql (tedious)
9
+ The useProxyForTedious has been removed, if you require this functionality please use v0.2.2 instead.
9
10
 
10
- yarn add @journeyapps/https-proxy-socket
11
+ ## Installation
12
+ ```bash
13
+ yarn add @journeyapps/https-proxy-socket
14
+ npm install @journeyapps/https-proxy-socket
15
+ pnpm add @journeyapps/https-proxy-socket
16
+ ```
11
17
 
12
18
  ## Usage - node-fetch
13
19
 
14
- const { HttpsProxySocket } = require('@journeyapps/https-proxy-socket');
15
- const fetch = require('node-fetch');
16
-
17
- // Proxy connection options
18
- const proxy = new HttpsProxySocket('https://my-proxy.test', {
19
- // Proxy auth and headers may be set here, for example:
20
- auth: 'myuser:mypassword' // Basic auth
21
- });
22
-
23
- const agent = proxy.agent({
24
- // Additional TLS options for the host may be set here, for example:
25
- // rejectUnauthorized: false, // Disable TLS checks completely (dangerous)
26
- // ca: fs.readFileSync('my-ca-cert.pem') // Use a custom CA cert
27
-
28
- // Documentation of the available options is available here:
29
- // https://nodejs.org/api/tls.html#tls_new_tls_tlssocket_socket_options
30
- // https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options
31
- });
32
-
33
- const response = await fetch('https://myhost.test', { agent: agent });
20
+ ```javascript
21
+ import { HttpsProxySocket } from '@journeyapps/https-proxy-socket';
22
+ import fetch from 'node-fetch';
23
+
24
+ /** Proxy connection options */
25
+ const proxy = new HttpsProxySocket('https://my-proxy.test', {
26
+ /** Proxy auth and headers may be set here, for example: */
27
+ auth: 'myuser:mypassword', // Basic auth
28
+ });
29
+
30
+ const agent = proxy.agent({
31
+ /**
32
+ * Additional TLS options for the host may be set here, for example:
33
+ * rejectUnauthorized: false, // Disable TLS checks completely (dangerous)
34
+ * ca: fs.readFileSync('my-ca-cert.pem') // Use a custom CA cert
35
+ *
36
+ * Documentation of the available options is available here:
37
+ * https://nodejs.org/api/tls.html#tls_new_tls_tlssocket_socket_options
38
+ * https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options
39
+ */
40
+ });
41
+
42
+ const response = await fetch('https://myhost.test', { agent: agent });
43
+ ```
34
44
 
35
45
  ## Usage - Direct socket
36
46
 
37
- const { HttpsProxySocket } = require('@journeyapps/https-proxy-socket');
38
- const proxy = new HttpsProxySocket('https://my-proxy.test');
39
-
40
- const socket = await proxy.connect({host: 'myhost.test', port: 1234});
41
-
42
- ## Usage - mssql
43
-
44
- const sql = require('mssql')
45
- const { HttpsProxySocket, useProxyForTedious } = require('@journeyapps/https-proxy-socket');
46
-
47
- const proxy = new HttpsProxySocket({
48
- // Same as above
49
- });
50
-
51
- // Register the proxy globally for tedious/mssql
52
- useProxyForTedious(proxy);
53
-
54
- async function run() {
55
- // Connect using the proxy
56
- await sql.connect('mssql://username:pwd@myserver.database.windows.net/mydb?encrypt=true')
57
- try {
58
- const result = await sql.query`Select TOP(1) * from mytable`
59
- console.dir(result);
60
- } finally {
61
- await sql.close();
62
- }
63
- }
64
-
65
- run().catch(console.error);
47
+ ```javascript
48
+ import { HttpsProxySocket } from '@journeyapps/https-proxy-socket';
49
+ const proxy = new HttpsProxySocket('https://my-proxy.test');
50
+
51
+ const socket = await proxy.connect({ host: 'myhost.test', port: 1234 });
52
+ ```
53
+
54
+ ## Usage - MongoDB
55
+
56
+ The socks package needs to be added to your package.json dependencies for this to work.
57
+ See the MongoDB documentation for details: https://www.mongodb.com/docs/drivers/node/current/security/socks/
58
+
59
+ ```javascript
60
+
61
+ import * as mongo from 'mongodb';
62
+ import { useProxyForMongo } from '@journeyapps/https-proxy-socket';
63
+
64
+ const SRV_URI = 'mongodb+srv://<username>:<password>@cluster0.jzuewet.mongodb.net';
65
+ const PROXY = 'us-cc-proxy.journeyapps.com'; // Or za-cc-proxy.journeyapps.com
66
+ const PROXY_PORT = 443
67
+
68
+ /**
69
+ * Register the proxy globally for MongoDB
70
+ * This retuens a close function to end the socket
71
+ */
72
+ const { close } = useProxyForMongo({
73
+ proxy: PROXY,
74
+ auth: <egress_token> // See JourneyApps MongoDB Token section below
75
+ });
76
+
77
+ async function run() {
78
+ const client = new mongo.MongoClient(SRV_URI, {
79
+ proxyPort: PROXY_PORT,
80
+ proxyHost: PROXY,
81
+ });
82
+ try {
83
+ const database = client.db('poc');
84
+ const data = database.collection('data');
85
+
86
+ const results = await data.find({ index: { $lt: 5 } }).toArray();
87
+ console.log(results);
88
+ } finally {
89
+ close()
90
+ await client.close();
91
+ }
92
+ }
93
+
94
+ run().catch(console.error);
95
+ ```
96
+
97
+ ## JourneyApps MongoDB Token
98
+
99
+ Using Mongo Atlas usually means the connection is a SRV string. Under the hood Mongo driver converts this to a standard connection string.
100
+ When the driver opens socket connections it will have one for each replica set member. These connections will need to be allowed by the CloudCode egress proxy to work.
101
+ Before contacting JourneyApps support to get your egress token, retrieve your SRV string from Atlas and run the following commands to get the replicas domains:
102
+
103
+ ```bash
104
+ # your SRV is mongodb+srv://<username>:<password>@cluster1.vlnzcbp.mongodb.net
105
+ # You can run it with the included credentials
106
+ npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://your_username:your_password@cluster1.vlnzcbp.mongodb.net
107
+ # Or without
108
+ npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://cluster1.vlnzcbp.mongodb.net
109
+ ```
110
+
111
+ This will output the below to your console:
112
+
113
+ ```javascript
114
+ {
115
+ replicas: 'ac-mayaavr-shard-00-02.vlnzcbp.mongodb.net:27017,ac-mayaavr-shard-00-01.vlnzcbp.mongodb.net:27017,ac-mayaavr-shard-00-00.vlnzcbp.mongodb.net:27017';
116
+ }
117
+ ```
118
+
119
+ When requesting the token from JourneyApps support, please provide the replicas string as well.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as tls from 'tls';
3
2
  export interface HttpsProxyConfig extends tls.ConnectionOptions {
4
3
  headers?: {
@@ -20,23 +19,24 @@ export declare class HttpsProxySocket {
20
19
  proxyConfig: HttpsProxyConfig;
21
20
  /**
22
21
  *
23
- * @param opts - The connection options to the proxy. At least host and port are required.
22
+ * @param options - The connection options to the proxy. At least host and port are required.
24
23
  * Use {rejectUnauthorized: true} to ignore certificates for the proxy (not the endpoint).
25
24
  * @param proxyConfig - { auth: 'username:password' } for basic auth.
26
25
  * { headers: {key: 'value'} } for custom headers.
27
26
  */
28
- constructor(opts: tls.ConnectionOptions | string, proxyConfig?: HttpsProxyConfig);
27
+ constructor(options: tls.ConnectionOptions | string, proxyConfig?: HttpsProxyConfig);
29
28
  /**
30
29
  * Create a new Socket connection.
31
30
  *
32
- * @param opts - host and port
31
+ * @param options - host and port
33
32
  */
34
- connect(opts: ConnectionOptions): Promise<tls.TLSSocket>;
33
+ connect(options: ConnectionOptions): Promise<tls.TLSSocket>;
35
34
  /**
36
35
  * Construct an agent for http(s) requests.
37
36
  *
38
37
  * @param options - to set additional TLS options for https requests, e.g. rejectUnauthorized
39
38
  */
40
- agent(options?: tls.ConnectionOptions): import("agent-base").Agent;
39
+ agent(options?: tls.ConnectionOptions): import("./ProxyAgent").ProxyAgent;
41
40
  private _connect;
42
41
  }
42
+ //# sourceMappingURL=HttpsProxySocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpsProxySocket.d.ts","sourceRoot":"","sources":["../../src/HttpsProxySocket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAS3B,MAAM,WAAW,gBAAiB,SAAQ,GAAG,CAAC,iBAAiB;IAC7D,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,KAAK,EAAE,GAAG,CAAC,iBAAiB,CAAC;IAC7B,WAAW,EAAE,gBAAgB,CAAC;IAE9B;;;;;;OAMG;gBACS,OAAO,EAAE,GAAG,CAAC,iBAAiB,GAAG,MAAM,EAAE,WAAW,CAAC,EAAE,gBAAgB;IAWnF;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IAe3D;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,iBAAiB;IAIrC,OAAO,CAAC,QAAQ;CAsHjB"}
@@ -1,36 +1,63 @@
1
1
  "use strict";
2
- // Based on https://github.com/TooTallNate/node-https-proxy-agent
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
3
35
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const tls = require("tls");
5
- const url = require("url");
6
- const proxyAgent_1 = require("./proxyAgent");
7
- const debug = require('debug')('https-proxy');
36
+ exports.HttpsProxySocket = void 0;
37
+ const tls = __importStar(require("tls"));
38
+ const createProxyAgent_1 = require("./createProxyAgent");
39
+ const setServername_1 = require("./utils/setServername");
40
+ const parseOptions_1 = require("./utils/parseOptions");
41
+ const util_1 = require("util");
42
+ const debug = (0, util_1.debug)('https-proxy');
8
43
  /**
9
44
  * The HttpsProxySocket class allows creating Socket connections via an HTTPS proxy.
10
45
  * HTTP proxies are not supported.
11
46
  * For http(s) requests, use HttpsProxyAgent as a wrapper around this.
12
47
  */
13
48
  class HttpsProxySocket {
49
+ proxy;
50
+ proxyConfig;
14
51
  /**
15
52
  *
16
- * @param opts - The connection options to the proxy. At least host and port are required.
53
+ * @param options - The connection options to the proxy. At least host and port are required.
17
54
  * Use {rejectUnauthorized: true} to ignore certificates for the proxy (not the endpoint).
18
55
  * @param proxyConfig - { auth: 'username:password' } for basic auth.
19
56
  * { headers: {key: 'value'} } for custom headers.
20
57
  */
21
- constructor(opts, proxyConfig) {
22
- let sanitizedOptions;
23
- if (typeof opts == 'string') {
24
- let parsedOptions = url.parse(opts);
25
- sanitizedOptions = {
26
- host: parsedOptions.hostname || parsedOptions.host,
27
- port: parseInt(parsedOptions.port || '443')
28
- };
29
- }
30
- else {
31
- sanitizedOptions = Object.assign({}, opts);
32
- }
33
- if (!opts) {
58
+ constructor(options, proxyConfig) {
59
+ const sanitizedOptions = (0, parseOptions_1.parseOptions)(options);
60
+ if (!options) {
34
61
  throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
35
62
  }
36
63
  debug('creating new HttpsProxyAgent instance: %o', sanitizedOptions);
@@ -40,15 +67,18 @@ class HttpsProxySocket {
40
67
  /**
41
68
  * Create a new Socket connection.
42
69
  *
43
- * @param opts - host and port
70
+ * @param options - host and port
44
71
  */
45
- connect(opts) {
46
- return new Promise((resolve, reject) => {
47
- this._connect(opts, (error, socket) => {
72
+ connect(options) {
73
+ return new Promise(async (resolve, reject) => {
74
+ this._connect(options, (error, socket) => {
48
75
  if (error) {
49
76
  reject(error);
50
77
  }
51
78
  else {
79
+ if (!socket) {
80
+ return reject(new Error('No socket returned from proxy'));
81
+ }
52
82
  resolve(socket);
53
83
  }
54
84
  });
@@ -60,18 +90,18 @@ class HttpsProxySocket {
60
90
  * @param options - to set additional TLS options for https requests, e.g. rejectUnauthorized
61
91
  */
62
92
  agent(options) {
63
- return proxyAgent_1.proxyAgent(this, options);
93
+ return (0, createProxyAgent_1.createProxyAgent)(this, options);
64
94
  }
65
95
  _connect(opts, cb) {
66
96
  const proxy = this.proxy;
67
97
  // create a socket connection to the proxy server
68
- const socket = tls.connect(proxy);
98
+ const socket = tls.connect((0, setServername_1.setServername)(proxy));
69
99
  // we need to buffer any HTTP traffic that happens with the proxy before we get
70
100
  // the CONNECT response, so that if the response is anything other than an "200"
71
101
  // response code, then we can re-play the "data" events on the socket once the
72
102
  // HTTP parser is hooked up...
73
- var buffers = [];
74
- var buffersLength = 0;
103
+ let buffers = [];
104
+ let buffersLength = 0;
75
105
  function read() {
76
106
  var b = socket.read();
77
107
  if (b) {
@@ -109,7 +139,7 @@ class HttpsProxySocket {
109
139
  if (str.indexOf(END_OF_HEADERS) < 0) {
110
140
  // keep buffering
111
141
  debug('have not received end of HTTP headers yet...');
112
- if (socket.read) {
142
+ if (socket.readable) {
113
143
  read();
114
144
  }
115
145
  else {
@@ -124,7 +154,7 @@ class HttpsProxySocket {
124
154
  // 200 Connected status code!
125
155
  const sock = socket;
126
156
  // nullify the buffered data since we won't be needing it
127
- buffers = null;
157
+ buffers = [];
128
158
  cleanup();
129
159
  cb(null, sock);
130
160
  }
@@ -134,7 +164,7 @@ class HttpsProxySocket {
134
164
  // the user can parse and handle the error status code
135
165
  cleanup();
136
166
  // nullify the buffered data since we won't be needing it
137
- buffers = null;
167
+ buffers = [];
138
168
  cleanup();
139
169
  socket.end();
140
170
  cb(new Error('Proxy connection failed: ' + firstLine), null);
@@ -143,15 +173,15 @@ class HttpsProxySocket {
143
173
  socket.on('error', onerror);
144
174
  socket.on('close', onclose);
145
175
  socket.on('end', onend);
146
- if (socket.read) {
176
+ if (socket.readable) {
147
177
  read();
148
178
  }
149
179
  else {
150
180
  socket.once('data', ondata);
151
181
  }
152
182
  const host = `${opts.host}:${opts.port}`;
153
- var msg = 'CONNECT ' + host + ' HTTP/1.1\r\n';
154
- var headers = Object.assign({}, this.proxyConfig.headers);
183
+ let msg = 'CONNECT ' + host + ' HTTP/1.1\r\n';
184
+ const headers = Object.assign({}, this.proxyConfig.headers);
155
185
  if (this.proxyConfig.auth) {
156
186
  headers['Proxy-Authorization'] = 'Basic ' + Buffer.from(this.proxyConfig.auth).toString('base64');
157
187
  }
@@ -164,3 +194,4 @@ class HttpsProxySocket {
164
194
  }
165
195
  }
166
196
  exports.HttpsProxySocket = HttpsProxySocket;
197
+ //# sourceMappingURL=HttpsProxySocket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpsProxySocket.js","sourceRoot":"","sources":["../../src/HttpsProxySocket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,yDAAsD;AACtD,yDAAsD;AACtD,uDAAoD;AAEpD,+BAA0C;AAE1C,MAAM,KAAK,GAAG,IAAA,YAAS,EAAC,aAAa,CAAC,CAAC;AAYvC;;;;GAIG;AACH,MAAa,gBAAgB;IAC3B,KAAK,CAAwB;IAC7B,WAAW,CAAmB;IAE9B;;;;;;OAMG;IACH,YAAY,OAAuC,EA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AAO,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAExB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,EAAE,CAAC;QACT,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,GAAG,GAAG,UAAU,GAAG,IAAI,GAAG,eAAe,CAAC;QAE9C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAC1B,OAAO,CAAC,qBAAqB,CAAC,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpG,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACvB,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI;YACzC,GAAG,IAAI,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF;AAzKD,4CAyKC"}
@@ -0,0 +1,11 @@
1
+ import { Agent, AgentConnectOpts } from 'agent-base';
2
+ import * as http from 'http';
3
+ import * as tls from 'tls';
4
+ import { HttpsProxySocket } from './HttpsProxySocket';
5
+ export declare class ProxyAgent extends Agent {
6
+ proxy: HttpsProxySocket;
7
+ agentOptions?: http.AgentOptions | undefined;
8
+ constructor(proxy: HttpsProxySocket, agentOptions?: http.AgentOptions | undefined);
9
+ connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<tls.TLSSocket>;
10
+ }
11
+ //# sourceMappingURL=ProxyAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyAgent.d.ts","sourceRoot":"","sources":["../../src/ProxyAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,UAAW,SAAQ,KAAK;IAE1B,KAAK,EAAE,gBAAgB;IACvB,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY;gBADhC,KAAK,EAAE,gBAAgB,EACvB,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,YAAA;IAInC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,gBAAgB;CAiBjE"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ProxyAgent = void 0;
37
+ const agent_base_1 = require("agent-base");
38
+ const tls = __importStar(require("tls"));
39
+ class ProxyAgent extends agent_base_1.Agent {
40
+ proxy;
41
+ agentOptions;
42
+ constructor(proxy, agentOptions) {
43
+ super(agentOptions);
44
+ this.proxy = proxy;
45
+ this.agentOptions = agentOptions;
46
+ }
47
+ async connect(req, options) {
48
+ const socket = await this.proxy.connect(options);
49
+ if (options.secureEndpoint) {
50
+ let tlsOptions = {
51
+ socket: socket,
52
+ servername: options.servername || options.host,
53
+ };
54
+ if (typeof options.rejectUnauthorized != 'undefined') {
55
+ tlsOptions.rejectUnauthorized = options.rejectUnauthorized;
56
+ }
57
+ Object.assign(tlsOptions, this.agentOptions);
58
+ return tls.connect(tlsOptions);
59
+ }
60
+ else {
61
+ socket.resume();
62
+ return socket;
63
+ }
64
+ }
65
+ }
66
+ exports.ProxyAgent = ProxyAgent;
67
+ //# sourceMappingURL=ProxyAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyAgent.js","sourceRoot":"","sources":["../../src/ProxyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAqD;AAErD,yCAA2B;AAG3B,MAAa,UAAW,SAAQ,kBAAK;IAE1B;IACA;IAFT,YACS,KAAuB,EACvB,YAAgC;QAEvC,KAAK,CAAC,YAAY,CAAC,CAAC;QAHb,UAAK,GAAL,KAAK,CAAkB;QACvB,iBAAY,GAAZ,YAAY,CAAoB;IAGzC,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAuB,EAAE,OAAyB;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAc,CAAC,CAAC;QACxD,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3B,IAAI,UAAU,GAA0B;gBACtC,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI;aAC/C,CAAC;YACF,IAAI,OAAO,OAAO,CAAC,kBAAkB,IAAI,WAAW,EAAE,CAAC;gBACrD,UAAU,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAC7D,CAAC;YACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;CACF;AAxBD,gCAwBC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=mongoReplicas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongoReplicas.d.ts","sourceRoot":"","sources":["../../../src/bin/mongoReplicas.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const promises_1 = require("dns/promises");
5
+ /**
6
+ * NPX script to resolve MongoDB SRV records.
7
+ * @example npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://<username>:<password>@cluster1.vlnzcbp.mongodb.net
8
+ * @example npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://cluster1.vlnzcbp.mongodb.net
9
+ *
10
+ * @returns An object with a `replicas` property containing the resolved host:port pairs.
11
+ */
12
+ async function mongoReplicas() {
13
+ const srvUrl = process.argv[3];
14
+ const url = new URL(srvUrl);
15
+ if (url.protocol !== 'mongodb+srv:') {
16
+ throw new Error('URL must start with mongodb+srv://');
17
+ }
18
+ const hostname = url.hostname;
19
+ const srvRecords = await (0, promises_1.resolveSrv)(`_mongodb._tcp.${hostname}`);
20
+ const targets = srvRecords.map((r) => `${r.name}:${r.port}`);
21
+ return { replicas: targets.join(',') };
22
+ }
23
+ mongoReplicas()
24
+ .then((result) => console.log(result))
25
+ .catch((error) => console.error(error));
26
+ //# sourceMappingURL=mongoReplicas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongoReplicas.js","sourceRoot":"","sources":["../../../src/bin/mongoReplicas.ts"],"names":[],"mappings":";;;AACA,2CAA0C;AAE1C;;;;;;GAMG;AACH,KAAK,UAAU,aAAa;IAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,GAAG,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,MAAM,UAAU,GAAG,MAAM,IAAA,qBAAU,EAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,aAAa,EAAE;KACZ,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACrC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { HttpsProxySocket } from './HttpsProxySocket.js';
2
+ import { ProxyAgent } from './ProxyAgent';
3
+ import * as http from 'node:http';
4
+ /**
5
+ * Construct an agent for http(s) requests. Mostly for testing purposes.
6
+ *
7
+ * @param proxy - the proxy to use
8
+ * @param options - to set additional TLS options for https requests, e.g. rejectUnauthorized
9
+ */
10
+ export declare function createProxyAgent(proxy: HttpsProxySocket, options?: http.AgentOptions): ProxyAgent;
11
+ //# sourceMappingURL=createProxyAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createProxyAgent.d.ts","sourceRoot":"","sources":["../../src/createProxyAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,cAEpF"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProxyAgent = createProxyAgent;
4
+ const ProxyAgent_1 = require("./ProxyAgent");
5
+ /**
6
+ * Construct an agent for http(s) requests. Mostly for testing purposes.
7
+ *
8
+ * @param proxy - the proxy to use
9
+ * @param options - to set additional TLS options for https requests, e.g. rejectUnauthorized
10
+ */
11
+ function createProxyAgent(proxy, options) {
12
+ return new ProxyAgent_1.ProxyAgent(proxy, options);
13
+ }
14
+ //# sourceMappingURL=createProxyAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createProxyAgent.js","sourceRoot":"","sources":["../../src/createProxyAgent.ts"],"names":[],"mappings":";;AAUA,4CAEC;AAXD,6CAA0C;AAG1C;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAuB,EAAE,OAA2B;IACnF,OAAO,IAAI,uBAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './HttpsProxySocket.js';
2
+ export * from './mongoPatch.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./HttpsProxySocket.js"), exports);
18
+ __exportStar(require("./mongoPatch.js"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,kDAAgC"}
@@ -0,0 +1,16 @@
1
+ import * as tls from 'tls';
2
+ interface Config {
3
+ /** The journey apps cc egress token */
4
+ auth: string;
5
+ /** The journey apps cc egress proxy domain */
6
+ proxy: string;
7
+ }
8
+ /**
9
+ * The patch should be called before instantiating the MongoClient
10
+ * @param config - The configuration for the proxy
11
+ */
12
+ export declare function useProxyForMongo(config: Config): {
13
+ close: () => tls.TLSSocket;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=mongoPatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongoPatch.d.ts","sourceRoot":"","sources":["../../src/mongoPatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,UAAU,MAAM;IACd,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf;AACD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM;;EAc9C"}