- Make ConnectReceived thread-safe with Volatile.Read/Write (accessed from auth timeout task and command pipeline) - Include authTimeoutTask in Task.WhenAny to propagate exceptions - Clear nonce after authentication with CryptographicOperations.ZeroMemory - Avoid closure allocation on publish permission cache hot path (method group) - Update AuthTimeout default to 2s to match Go server
31 lines
972 B
C#
31 lines
972 B
C#
using NATS.Server.Auth;
|
|
|
|
namespace NATS.Server;
|
|
|
|
public sealed class NatsOptions
|
|
{
|
|
public string Host { get; set; } = "0.0.0.0";
|
|
public int Port { get; set; } = 4222;
|
|
public string? ServerName { get; set; }
|
|
public int MaxPayload { get; set; } = 1024 * 1024; // 1MB
|
|
public int MaxControlLine { get; set; } = 4096;
|
|
public int MaxConnections { get; set; } = 65536;
|
|
public TimeSpan PingInterval { get; set; } = TimeSpan.FromMinutes(2);
|
|
public int MaxPingsOut { get; set; } = 2;
|
|
|
|
// Simple auth (single user)
|
|
public string? Username { get; set; }
|
|
public string? Password { get; set; }
|
|
public string? Authorization { get; set; }
|
|
|
|
// Multiple users/nkeys
|
|
public IReadOnlyList<User>? Users { get; set; }
|
|
public IReadOnlyList<NKeyUser>? NKeys { get; set; }
|
|
|
|
// Default/fallback
|
|
public string? NoAuthUser { get; set; }
|
|
|
|
// Auth timing
|
|
public TimeSpan AuthTimeout { get; set; } = TimeSpan.FromSeconds(2);
|
|
}
|