You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 line
838 B

  1. using System;
  2. namespace MQTTnet.Server
  3. {
  4. public static class MqttServerOptionsExtensions
  5. {
  6. public static int GetTlsEndpointPort(this IMqttServerOptions options)
  7. {
  8. if (options == null) throw new ArgumentNullException(nameof(options));
  9. if (!options.TlsEndpointOptions.Port.HasValue)
  10. {
  11. return 8883;
  12. }
  13. return options.TlsEndpointOptions.Port.Value;
  14. }
  15. public static int GetDefaultEndpointPort(this IMqttServerOptions options)
  16. {
  17. if (options == null) throw new ArgumentNullException(nameof(options));
  18. if (!options.DefaultEndpointOptions.Port.HasValue)
  19. {
  20. return 1883;
  21. }
  22. return options.DefaultEndpointOptions.Port.Value;
  23. }
  24. }
  25. }