File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 3
3
* @returns {Duplex }
4
4
*/
5
5
module . exports . getStream = function getStream ( ssl ) {
6
- try {
7
- const { CloudflareSocket } = require ( 'pg-cloudflare' )
8
- return new CloudflareSocket ( ssl )
9
- } catch {
6
+ if ( process ?. release ?. name === 'node' ) {
10
7
const net = require ( 'net' )
11
8
return new net . Socket ( )
9
+ } else {
10
+ const { CloudflareSocket } = require ( 'pg-cloudflare' )
11
+ return new CloudflareSocket ( ssl )
12
12
}
13
13
}
14
14
@@ -18,11 +18,11 @@ module.exports.getStream = function getStream(ssl) {
18
18
* @returns {Duplex }
19
19
*/
20
20
module . exports . getSecureStream = function getSecureStream ( options ) {
21
- try {
22
- options . socket . startTls ( options )
23
- return options . socket
24
- } catch {
21
+ if ( process ?. release ?. name === 'node' ) {
25
22
var tls = require ( 'tls' )
26
23
return tls . connect ( options )
24
+ } else {
25
+ options . socket . startTls ( options )
26
+ return options . socket
27
27
}
28
28
}
You can’t perform that action at this time.
0 commit comments