diff --git a/Source/MQTTnet.Server/Program.cs b/Source/MQTTnet.Server/Program.cs index 5d50030b..b721a143 100644 --- a/Source/MQTTnet.Server/Program.cs +++ b/Source/MQTTnet.Server/Program.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using MQTTnet.Server.Configuration; namespace MQTTnet.Server { @@ -72,75 +69,9 @@ namespace MQTTnet.Server }); }); - //var listen = ReadListenSettings(); - //webHost - // .UseKestrel(o => - // { - // if (listen?.Length > 0) - // { - // foreach (var item in listen) - // { - // if (item.Address?.Trim() == "*") - // { - // if (item.Protocol == ListenProtocolTypes.MQTT) - // { - // o.ListenAnyIP(item.Port, c => c.UseMqtt()); - // } - // else - // { - // o.ListenAnyIP(item.Port); - // } - // } - // else if (item.Address?.Trim() == "localhost") - // { - // if (item.Protocol == ListenProtocolTypes.MQTT) - // { - // o.ListenLocalhost(item.Port, c => c.UseMqtt()); - // } - // else - // { - // o.ListenLocalhost(item.Port); - // } - // } - // else - // { - // if (IPAddress.TryParse(item.Address, out var ip)) - // { - // if (item.Protocol == ListenProtocolTypes.MQTT) - // { - // o.Listen(ip, item.Port, c => c.UseMqtt()); - // } - // else - // { - // o.Listen(ip, item.Port); - // } - // } - // } - // } - // } - // else - // { - // o.ListenAnyIP(1883, l => l.UseMqtt()); - // o.ListenAnyIP(5000); - // } - // }); - webHost.UseStartup(); return webHost; } - - public static ListenModel[] ReadListenSettings() - { - var builder = new ConfigurationBuilder() - .AddJsonFile("appsettings.json") - .AddEnvironmentVariables() - .Build(); - - var listen = new List(); - builder.Bind("MQTTnetServer:Listen", listen); - - return listen.ToArray(); - } } }