浏览代码

Add methods for client options builder

release/3.x.x
Christian Kratky 7 年前
父节点
当前提交
522a385523
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. +19
    -0
      MQTTnet.Core/Client/MqttClientOptionsBuilder.cs

+ 19
- 0
MQTTnet.Core/Client/MqttClientOptionsBuilder.cs 查看文件

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using MQTTnet.Core.Serializer;

namespace MQTTnet.Core.Client
@@ -79,6 +80,24 @@ namespace MQTTnet.Core.Client
return this;
}

public MqttClientOptionsBuilder WithTls(
bool allowUntrustedCertificates = false,
bool ignoreCertificateChainErrors = false,
bool ignoreCertificateRevocationErrors = false,
params byte[][] certificates)
{
_tlsOptions = new MqttClientTlsOptions
{
UseTls = true,
AllowUntrustedCertificates = allowUntrustedCertificates,
IgnoreCertificateChainErrors = ignoreCertificateChainErrors,
IgnoreCertificateRevocationErrors = ignoreCertificateRevocationErrors,
Certificates = certificates.ToList()
};

return this;
}

public MqttClientOptionsBuilder WithTls()
{
_tlsOptions = new MqttClientTlsOptions


正在加载...
取消
保存