In ClientParams, ssl should be optional, or boolean as a shortcut. All SSLConnectionParams fields should be optional as supported by tls.connect()
export interface SSLConnectionParams {
key?: string
cert?: string
ca?: string
rejectUnauthorized?: boolean
}
Pseudocode for the socket creation:
private createSocket() {
const socket = this.params.ssl
? tls.connect(this.params.port, this.params.hostname, typeof this.params.ssl === Boolean ? {} : this.params.ssl)
: new Socket().connect(this.params.port, this.params.hostname)
if (this.params.socketTimeout) socket.setTimeout(this.params.socketTimeout)
return socket
}
This will also address #254