有奖捉虫:办公协同&微信生态&物联网文档专题 HOT
TLSConfig 是全局参数配置 Option 中的 tlsConfig 配置项。

字段

字段
类型
描述
insecureSkipVerify
boolean
控制客户端是否验证服务器的证书链和主机名;如果为真,crypto/tls 接受服务器提供的任何证书以及该证书中的任何主机名
rootCAs
string
根证书
certificates
客户端证书列表
serverName
string
匹配证书里的主机名

样例

使用 TLSConfig:
export const option = {
tlsConfig: {
'localhost': {
insecureSkipVerify: false,
rootCAs: [open('ca.crt')],
certificates: [
{
cert: open('client.crt'),
key: open('client.key')
}
],
serverName: "xxx.com"
}
}
}