25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
841 B

  1. using System;
  2. namespace MQTTnet.Core.Server
  3. {
  4. public static class MqttServerOptionsExtensions
  5. {
  6. public static int GetTlsEndpointPort(this MqttServerOptions 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 MqttServerOptions 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. }