47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
namespace NATS.Server;
|
|
|
|
/// <summary>
|
|
/// MQTT protocol configuration options.
|
|
/// Corresponds to Go server/opts.go MQTTOpts struct.
|
|
/// Config is parsed and stored but no MQTT listener is started yet.
|
|
/// </summary>
|
|
public sealed class MqttOptions
|
|
{
|
|
// Network
|
|
public string Host { get; set; } = "";
|
|
public int Port { get; set; }
|
|
|
|
// Auth override (MQTT-specific, separate from global auth)
|
|
public string? NoAuthUser { get; set; }
|
|
public string? Username { get; set; }
|
|
public string? Password { get; set; }
|
|
public string? Token { get; set; }
|
|
public double AuthTimeout { get; set; }
|
|
|
|
// TLS
|
|
public string? TlsCert { get; set; }
|
|
public string? TlsKey { get; set; }
|
|
public string? TlsCaCert { get; set; }
|
|
public bool TlsVerify { get; set; }
|
|
public double TlsTimeout { get; set; } = 2.0;
|
|
public bool TlsMap { get; set; }
|
|
public HashSet<string>? TlsPinnedCerts { get; set; }
|
|
|
|
// JetStream integration
|
|
public string? JsDomain { get; set; }
|
|
public int StreamReplicas { get; set; }
|
|
public int ConsumerReplicas { get; set; }
|
|
public bool ConsumerMemoryStorage { get; set; }
|
|
public TimeSpan ConsumerInactiveThreshold { get; set; }
|
|
|
|
// QoS
|
|
public TimeSpan AckWait { get; set; } = TimeSpan.FromSeconds(30);
|
|
public ushort MaxAckPending { get; set; }
|
|
public TimeSpan JsApiTimeout { get; set; } = TimeSpan.FromSeconds(5);
|
|
public bool SessionPersistence { get; set; } = true;
|
|
public TimeSpan SessionTtl { get; set; } = TimeSpan.FromHours(1);
|
|
public bool Qos1PubAck { get; set; } = true;
|
|
|
|
public bool HasTls => TlsCert != null && TlsKey != null;
|
|
}
|