PortForwardSpec

Desired OPNsense Destination NAT (port-forward / rdr) rule. Identified by Description for idempotency. Forwards inbound traffic hitting DestinationNet:DestinationPort on Interface to TargetIp:TargetPort.

public sealed record PortForwardSpec : IEquatable<PortForwardSpec>

1. Constructors

1.1. PortForwardSpec(string, string, string, string, string, string, string, string)

Desired OPNsense Destination NAT (port-forward / rdr) rule. Identified by Description for idempotency. Forwards inbound traffic hitting DestinationNet:DestinationPort on Interface to TargetIp:TargetPort.

public PortForwardSpec(string Description, string Interface, string Protocol, string SourceNet, string DestinationNet, string DestinationPort, string TargetIp, string TargetPort)
Table 1. Parameters
Name Type Description

Description

string

Stable identity. Prefix with netsetup- for managed delete safety.

Interface

string

OPNsense interface the rule binds to (e.g. wan).

Protocol

string

Transport protocol (e.g. tcp, udp, tcp/udp).

SourceNet

string

Source network (e.g. any).

DestinationNet

string

Match destination (e.g. wanip or a literal address).

DestinationPort

string

Match destination port (single, list or range).

TargetIp

string

Redirect target host (the internal VM IP).

TargetPort

string

Redirect target port.

2. Properties

2.1. Description

Stable identity. Prefix with netsetup- for managed delete safety.

public string Description { get; init; }

2.2. DestinationNet

Match destination (e.g. wanip or a literal address).

public string DestinationNet { get; init; }

2.3. DestinationPort

Match destination port (single, list or range).

public string DestinationPort { get; init; }

2.4. Interface

OPNsense interface the rule binds to (e.g. wan).

public string Interface { get; init; }

2.5. Protocol

Transport protocol (e.g. tcp, udp, tcp/udp).

public string Protocol { get; init; }

2.6. SourceNet

Source network (e.g. any).

public string SourceNet { get; init; }

2.7. TargetIp

Redirect target host (the internal VM IP).

public string TargetIp { get; init; }

2.8. TargetPort

Redirect target port.

public string TargetPort { get; init; }

3. Operators

3.1. operator !=(PortForwardSpec, PortForwardSpec)

public static bool operator !=(PortForwardSpec left, PortForwardSpec right)
Table 2. Parameters
Name Type Description

left

PortForwardSpec

right

PortForwardSpec

Returns: bool

3.2. operator ==(PortForwardSpec, PortForwardSpec)

public static bool operator ==(PortForwardSpec left, PortForwardSpec right)
Table 3. Parameters
Name Type Description

left

PortForwardSpec

right

PortForwardSpec

Returns: bool