Allow changing TLS connection options in client
This commit is contained in:
parent
d84456db12
commit
4708b61cf4
|
@ -31,6 +31,7 @@ client is:
|
||||||
||timeout||How long the client should let operations live for before timing out. Default is Infinity.||
|
||timeout||How long the client should let operations live for before timing out. Default is Infinity.||
|
||||||
||connectTimeout||How long the client should wait before timing out on TCP connections. Default is up to the OS.||
|
||connectTimeout||How long the client should wait before timing out on TCP connections. Default is up to the OS.||
|
||||||
||maxConnections||Whether or not to enable connection pooling, and if so, how many to maintain.||
|
||maxConnections||Whether or not to enable connection pooling, and if so, how many to maintain.||
|
||||||
|
||tlsOptions||Additional [options](http://nodejs.org/api/tls.html#tls_tls_connect_port_host_options_callback) passed to the TLS connection layer when connecting via `ldaps://`||
|
||||||
|
|
||||||
If using connection pooling, you can additionally pass in:
|
If using connection pooling, you can additionally pass in:
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,7 @@ function Client(options) {
|
||||||
this.log = options.log.child({clazz: 'Client'}, true);
|
this.log = options.log.child({clazz: 'Client'}, true);
|
||||||
this.port = _url ? _url.port : false;
|
this.port = _url ? _url.port : false;
|
||||||
this.secure = _url ? _url.secure : false;
|
this.secure = _url ? _url.secure : false;
|
||||||
|
this.tlsOptions = options.tlsOptions;
|
||||||
this.socketPath = options.socketPath || false;
|
this.socketPath = options.socketPath || false;
|
||||||
this.timeout = parseInt((options.timeout || 0), 10);
|
this.timeout = parseInt((options.timeout || 0), 10);
|
||||||
this.url = _url;
|
this.url = _url;
|
||||||
|
@ -721,7 +722,7 @@ Client.prototype._connect = function _connect() {
|
||||||
self.emit('connect', socket);
|
self.emit('connect', socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
socket = proto.connect((this.port || this.socketPath), this.host);
|
socket = proto.connect((this.port || this.socketPath), this.host, this.secure ? this.tlsOptions : null);
|
||||||
|
|
||||||
socket.once('connect', onConnect);
|
socket.once('connect', onConnect);
|
||||||
socket.once('secureConnect', onConnect);
|
socket.once('secureConnect', onConnect);
|
||||||
|
|
|
@ -115,7 +115,8 @@ function ClientPool(options) {
|
||||||
log: options.log,
|
log: options.log,
|
||||||
socketPath: options.socketPath,
|
socketPath: options.socketPath,
|
||||||
timeout: (options.timeout || 0),
|
timeout: (options.timeout || 0),
|
||||||
url: options.url
|
url: options.url,
|
||||||
|
tlsOptions: options.tlsOptions
|
||||||
};
|
};
|
||||||
this.pool = createPool(options);
|
this.pool = createPool(options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue