Files
natsdotnet/src/NATS.Server/Configuration/LeafNodeOptions.cs
Joseph Doherty 1a3fe91611 feat: enhance ConfigProcessor & add 110 Go-parity opts tests (Task 22)
Port configuration parsing for NKey users, gateway remotes, leaf node
remotes, auth timeout, write_deadline, websocket ping_interval, and
token+users conflict validation. Add RemoteGatewayOptions, enhanced
LeafNodeOptions with remotes support.

110 new tests ported from opts_test.go.
2026-02-24 20:17:48 -05:00

64 lines
2.1 KiB
C#

namespace NATS.Server.Configuration;
/// <summary>
/// Remote leaf node entry parsed from the remotes[] array inside a leafnodes {} block.
/// Go reference: opts.go RemoteLeafOpts struct.
/// </summary>
public sealed class RemoteLeafOptions
{
/// <summary>Local account to bind this remote to.</summary>
public string? LocalAccount { get; init; }
/// <summary>Path to credentials file.</summary>
public string? Credentials { get; init; }
/// <summary>URLs for this remote entry.</summary>
public List<string> Urls { get; init; } = [];
/// <summary>Whether to not randomize URL order.</summary>
public bool DontRandomize { get; init; }
}
public sealed class LeafNodeOptions
{
public string Host { get; set; } = "0.0.0.0";
public int Port { get; set; }
// Auth for leaf listener
public string? Username { get; set; }
public string? Password { get; set; }
public double AuthTimeout { get; set; }
// Advertise address
public string? Advertise { get; set; }
// Per-subsystem write deadline
public TimeSpan WriteDeadline { get; set; }
/// <summary>
/// Simple URL list for programmatic setup (tests, server-code wiring).
/// Parsed config populates RemoteLeaves instead.
/// </summary>
public List<string> Remotes { get; set; } = [];
/// <summary>
/// Remote leaf node entries parsed from a config file (remotes: [] array).
/// Each entry has a local account, credentials, and a list of URLs.
/// </summary>
public List<RemoteLeafOptions> RemoteLeaves { get; set; } = [];
/// <summary>
/// JetStream domain for this leaf node.
/// Go reference: leafnode.go -- JsDomain in leafNodeCfg.
/// </summary>
public string? JetStreamDomain { get; set; }
public List<string> DenyExports { get; set; } = [];
public List<string> DenyImports { get; set; } = [];
public List<string> ExportSubjects { get; set; } = [];
public List<string> ImportSubjects { get; set; } = [];
/// <summary>List of users for leaf listener authentication (from authorization.users).</summary>
public List<NATS.Server.Auth.User>? Users { get; set; }
}