diff --git a/Source/MQTTnet.Server/Configuration/ListenModel.cs b/Source/MQTTnet.Server/Configuration/ListenModel.cs index e72d8975..52c5de42 100644 --- a/Source/MQTTnet.Server/Configuration/ListenModel.cs +++ b/Source/MQTTnet.Server/Configuration/ListenModel.cs @@ -79,8 +79,8 @@ namespace MQTTnet.Server.Configuration if (IPv4 == "disable") { - address = null; - return false; + address = IPAddress.None; + return true; } if (IPAddress.TryParse(IPv4, out var ip)) @@ -114,8 +114,8 @@ namespace MQTTnet.Server.Configuration if (IPv6 == "disable") { - address = null; - return false; + address = IPAddress.None; + return true; } if (IPAddress.TryParse(IPv6, out var ip)) diff --git a/Source/MQTTnet.Server/Mqtt/MqttServerService.cs b/Source/MQTTnet.Server/Mqtt/MqttServerService.cs index 7a5d7577..bac16868 100644 --- a/Source/MQTTnet.Server/Mqtt/MqttServerService.cs +++ b/Source/MQTTnet.Server/Mqtt/MqttServerService.cs @@ -114,7 +114,7 @@ namespace MQTTnet.Server.Mqtt if (_settings.EndpointEncryption.TryReadIPv6(out var address6)) { - options.WithEncryptedEndpointBoundIPAddress(address6); + options.WithEncryptedEndpointBoundIPV6Address(address6); } if (_settings.Endpoint.Port > 0) diff --git a/Source/MQTTnet.Server/appsettings.json b/Source/MQTTnet.Server/appsettings.json index 1b563e36..09251354 100644 --- a/Source/MQTTnet.Server/appsettings.json +++ b/Source/MQTTnet.Server/appsettings.json @@ -17,7 +17,7 @@ "IPv4": "localhost", "IPv6": "localhost", "Port": 8883, - "CertificatePath": "/absolute/path/to/certificate" + "CertificatePath": "/absolute/path/to/pfx" }, "CommunicationTimeout": 15, /* In seconds */ "ConnectionBacklog": 0, /* Set 0 to disable */ diff --git a/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs b/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs index f43ff862..451940aa 100644 --- a/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs +++ b/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs @@ -75,6 +75,12 @@ namespace MQTTnet.Server return this; } + public MqttServerOptionsBuilder WithEncryptedEndpointBoundIPV6Address(IPAddress value) + { + _options.TlsEndpointOptions.BoundInterNetworkV6Address = value; + return this; + } + public MqttServerOptionsBuilder WithEncryptionCertificate(byte[] value) { _options.TlsEndpointOptions.Certificate = value;