Path: redb-route/redb.Route.Ftp/FtpEndpointOptions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Ftp/FtpEndpointOptions.cs
----
using redb.Route.GenericFile;
namespace redb.Route.Ftp;
///
/// Endpoint options for FTP transport. All properties are auto-bound from URI query parameters.
///
/// URI format: ftp:///remote/path?host=server&port=21&username=admin&password=secret&...
///
///
/// Inherits shared polling, post-processing, idempotency, and producer options from
/// . Adds FTP-specific: passive mode, FTPS/TLS,
/// transfer type, and more.
///
///
public class FtpEndpointOptions : RemoteFileEndpointOptions
{
/// Creates FTP endpoint options with protocol-specific defaults.
public FtpEndpointOptions()
{
Delay = 60_000;
InitialDelay = 1000;
StartingDirectoryMustExist = true;
}
// ═══════════════════════════════════════════════════════════════════
// CONNECTION: FTP-specific
// ═══════════════════════════════════════════════════════════════════
/// FTP server port. (default: 21)
public override int Port { get; set; } = 21;
///
/// Use passive mode for data connections. Most firewalls/NATs require passive mode.
/// (default: true)
///
public bool PassiveMode { get; set; } = true;
// ═══════════════════════════════════════════════════════════════════
// TLS / FTPS
// ═══════════════════════════════════════════════════════════════════
///
/// Enable FTP over TLS (FTPS). When true, uses explicit TLS negotiation.
/// (default: false)
///
public bool UseFtps { get; set; }
///
/// If true, accept any server certificate (useful for self-signed certs in dev/test).
/// If false, validate server certificate against system trust store. (default: true)
///
public bool ValidateCertificate { get; set; } = true;
// ═══════════════════════════════════════════════════════════════════
// TRANSFER OPTIONS
// ═══════════════════════════════════════════════════════════════════
///
/// Transfer type: Binary (raw bytes, default) or Ascii (line-ending conversion).
///
public FtpTransferType TransferType { get; set; } = FtpTransferType.Binary;
///
/// If true, silently ignore file-not-found or permission errors during listing.
/// (default: false)
///
public bool IgnoreFileNotFoundOrPermissionError { get; set; }
// ═══════════════════════════════════════════════════════════════════
// PRODUCER: FTP-specific
// ═══════════════════════════════════════════════════════════════════
///
/// Strategy for moving existing files when FileExist=Move. (default: Timestamp)
///
public FtpMoveExistingStrategy MoveExistingFileStrategy { get; set; } = FtpMoveExistingStrategy.Timestamp;
///
/// If true, flatten nested directory structures — all files are uploaded to the base directory.
/// (default: false)
///
public bool Flatten { get; set; }
///
/// If true, prevent the producer from writing outside the base directory.
/// FileName expressions that navigate with ".." are rejected. (default: true)
///
public bool JailStartingDirectory { get; set; } = true;
// ═══════════════════════════════════════════════════════════════════
// VALIDATION
// ═══════════════════════════════════════════════════════════════════
///
public override void Validate()
{
ValidateRemote();
if (string.IsNullOrWhiteSpace(Host))
throw new ArgumentException("FTP Host must be specified.");
}
}