File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # https-proxy-socket
2+
3+ Node library to enable opening Socket connections via an HTTPS proxy.
4+
5+ ## Installation
6+
7+ yarn add @journeyapps/https-proxy-socket
8+
9+ ## Usage
10+
11+
12+ const { HttpsProxySocket } = require('@journeyapps/https-proxy-socket');
13+ const proxy = new HttpsProxySocket({
14+ // Connection options
15+ host: 'my-proxy.test',
16+ port: 443
17+ }, {
18+ auth: 'myuser:mypassword' // Optional: proxy basic auth
19+ });
20+
21+ const socket = await proxy.connect({host: 'myhost.test', port: 1234});
22+
23+ ## Usage with mssql
24+
25+
26+ const sql = require('mssql')
27+ const { useProxy } = require('@journeyapps/https-proxy-socket/lib/TediousPatch');
28+
29+ const { HttpsProxySocket } = require('./lib/HttpsProxySocket');
30+ const proxy = new HttpsProxySocket({
31+ // Same as above
32+ });
33+
34+ // Register the proxy globally for tedious/mssql
35+ useProxy(proxy);
36+
37+ async function run() {
38+ // Connect using the proxy
39+ await sql.connect('mssql://username:pwd@myserver.database.windows.net/mydb?encrypt=true')
40+ try {
41+ const result = await sql.query`Select TOP(1) * from mytable`
42+ console.dir(result);
43+ } finally {
44+ await sql.close();
45+ }
46+ }
47+
48+ run().catch(console.error);
You can’t perform that action at this time.
0 commit comments