ddan-js 2.6.34 → 2.6.35
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.
|
@@ -6,12 +6,6 @@ const socks_1 = require("socks");
|
|
|
6
6
|
const uuid_1 = require("../crypto/uuid");
|
|
7
7
|
const mapping_1 = require("../../class/mapping");
|
|
8
8
|
const index_1 = require("../qs/index");
|
|
9
|
-
const Socks5Event = {
|
|
10
|
-
Error: 'error',
|
|
11
|
-
};
|
|
12
|
-
// interface IConnectionPool {
|
|
13
|
-
// [key: string]: Socket // Key为目标地址:端口组合
|
|
14
|
-
// }
|
|
15
9
|
class Socks5 {
|
|
16
10
|
upstreamProxy;
|
|
17
11
|
server = null;
|
|
@@ -246,15 +240,14 @@ class Socks5 {
|
|
|
246
240
|
},
|
|
247
241
|
};
|
|
248
242
|
try {
|
|
249
|
-
const { socket:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
upstreamSocket.on('close', () => {
|
|
243
|
+
const { socket: systemSocket } = await socks_1.SocksClient.createConnection(options);
|
|
244
|
+
this.connectionPool.set(destKey, systemSocket);
|
|
245
|
+
systemSocket.on('close', () => {
|
|
253
246
|
// delete this.connectionPool[destKey]
|
|
254
247
|
this.__debug && console.info('[socks] connection pool delete', destKey);
|
|
255
248
|
this.connectionPool.delete(destKey);
|
|
256
249
|
});
|
|
257
|
-
return
|
|
250
|
+
return systemSocket;
|
|
258
251
|
}
|
|
259
252
|
catch (err) {
|
|
260
253
|
throw new Error('Failed to connect to system proxy: ' + err);
|