Add unit tests for Router configuration and transport layers
- Implemented tests for RouterConfig, RoutingOptions, StaticInstanceConfig, and RouterConfigOptions to ensure default values are set correctly. - Added tests for RouterConfigProvider to validate configurations and ensure defaults are returned when no file is specified. - Created tests for ConfigValidationResult to check success and error scenarios. - Developed tests for ServiceCollectionExtensions to verify service registration for RouterConfig. - Introduced UdpTransportTests to validate serialization, connection, request-response, and error handling in UDP transport. - Added scripts for signing authority gaps and hashing DevPortal SDK snippets.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System.Net;
|
||||
|
||||
namespace StellaOps.Router.Transport.Tcp;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration options for TCP transport.
|
||||
/// </summary>
|
||||
public sealed class TcpTransportOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the address to bind to.
|
||||
/// Default: IPAddress.Any (0.0.0.0).
|
||||
/// </summary>
|
||||
public IPAddress BindAddress { get; set; } = IPAddress.Any;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port to listen on.
|
||||
/// Default: 5100.
|
||||
/// </summary>
|
||||
public int Port { get; set; } = 5100;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the receive buffer size.
|
||||
/// Default: 64 KB.
|
||||
/// </summary>
|
||||
public int ReceiveBufferSize { get; set; } = 64 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the send buffer size.
|
||||
/// Default: 64 KB.
|
||||
/// </summary>
|
||||
public int SendBufferSize { get; set; } = 64 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the keep-alive interval.
|
||||
/// Default: 30 seconds.
|
||||
/// </summary>
|
||||
public TimeSpan KeepAliveInterval { get; set; } = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection timeout.
|
||||
/// Default: 10 seconds.
|
||||
/// </summary>
|
||||
public TimeSpan ConnectTimeout { get; set; } = TimeSpan.FromSeconds(10);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of reconnection attempts.
|
||||
/// Default: 10.
|
||||
/// </summary>
|
||||
public int MaxReconnectAttempts { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum reconnection backoff.
|
||||
/// Default: 1 minute.
|
||||
/// </summary>
|
||||
public TimeSpan MaxReconnectBackoff { get; set; } = TimeSpan.FromMinutes(1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum frame size in bytes.
|
||||
/// Default: 16 MB.
|
||||
/// </summary>
|
||||
public int MaxFrameSize { get; set; } = 16 * 1024 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the host for client connections.
|
||||
/// </summary>
|
||||
public string? Host { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user