Skip to content

Commit c401fe3

Browse files
committed
Add README.
1 parent 159184f commit c401fe3

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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);

0 commit comments

Comments
 (0)