tls: `checkServerIdentity` option

Allow overriding `checkServerIdentity` function, when connecting to a
TLS server.

Reviewed-By: Fedor Indutny <fedor@indutny.com>