@@ -23,6 +23,17 @@ module.exports = {
23
23
srcPort : function ( ) {
24
24
var range = MAX_PORT_NUMBER - MIN_PORT_NUMBER + 1 ;
25
25
return Math . floor ( Math . random ( ) * range ) + MIN_PORT_NUMBER ;
26
+ } ,
27
+ tunnelClient : function ( context ) {
28
+ // if you want to provide your own ssh client to be used instead of one from this plugin,
29
+ // must follow this signature
30
+ // createTunnel(
31
+ // tunnelOptions: TunnelOptions,
32
+ // serverOptions: ServerOptions,
33
+ // sshOptions: SshOptions,
34
+ // forwardOptions: ForwardOptions
35
+ // ): Promise<[Server, Client]>;
36
+ return context . tunnelClient || createTunnel ;
26
37
}
27
38
} ,
28
39
@@ -44,6 +55,14 @@ module.exports = {
44
55
) ;
45
56
}
46
57
58
+ const tunnel = this . readConfig ( 'tunnelClient' ) ;
59
+
60
+ let privateKey = this . readConfig ( 'privateKey' ) ;
61
+
62
+ if ( this . readConfig ( 'privateKeyPath' ) ) {
63
+ privateKey = fs . readFileSync ( untildify ( this . readConfig ( 'privateKeyPath' ) ) ) ;
64
+ }
65
+
47
66
const tunnelOptions = {
48
67
autoClose : true
49
68
} ;
@@ -52,12 +71,6 @@ module.exports = {
52
71
port : srcPort
53
72
} ;
54
73
55
- let privateKey = this . readConfig ( 'privateKey' ) ;
56
-
57
- if ( this . readConfig ( 'privateKeyPath' ) ) {
58
- privateKey = fs . readFileSync ( untildify ( this . readConfig ( 'privateKeyPath' ) ) ) ;
59
- }
60
-
61
74
const sshOptions = {
62
75
host : this . readConfig ( 'host' ) ,
63
76
port : this . readConfig ( 'port' ) ,
@@ -75,7 +88,7 @@ module.exports = {
75
88
} ;
76
89
77
90
return new RSVP . Promise ( function ( resolve , reject ) {
78
- createTunnel ( tunnelOptions , serverOptions , sshOptions , forwardOptions )
91
+ tunnel ( tunnelOptions , serverOptions , sshOptions , forwardOptions )
79
92
. then ( ( [ server ] ) => {
80
93
resolve ( {
81
94
tunnel : {
0 commit comments