Table of Contents

Struct FirewallPortSpec

Namespace
FishMMO.Installer
Assembly
FishMMO-Installer.dll

A single firewall rule: one port or an inclusive port range, on TCP or UDP. Deserializes from install-config.json as either a bare integer (443, TCP) or a string ("7770-7999/udp", "8080/tcp", "7770-7999"). Protocol defaults to TCP when omitted.

[JsonConverter(typeof(FirewallPortSpecJsonConverter))]
public readonly record struct FirewallPortSpec : IEquatable<FirewallPortSpec>
Implements
Inherited Members

Constructors

FirewallPortSpec(int, int, string)

public FirewallPortSpec(int from, int to, string protocol)

Parameters

from int
to int
protocol string

Fields

Tcp

public const string Tcp = "tcp"

Field Value

string

Udp

public const string Udp = "udp"

Field Value

string

Properties

From

First port in the range (inclusive).

public int From { get; }

Property Value

int

IsRange

True when this spec covers more than one port.

public bool IsRange { get; }

Property Value

bool

PortText

Port text without protocol, hyphenated for ranges (7770-7999).

public string PortText { get; }

Property Value

string

Protocol

Lower-case protocol: tcp or udp.

public string Protocol { get; }

Property Value

string

To

Last port in the range (inclusive). Equals From for a single port.

public int To { get; }

Property Value

int

UfwPortText

Port text using the ufw range separator (7770:7999).

public string UfwPortText { get; }

Property Value

string

Methods

Parse(string)

Parses "443", "443/tcp", "7770-7999", "7770-7999/udp" or "7770:7999/udp". Throws FormatException with a message that names the offending text.

public static FirewallPortSpec Parse(string text)

Parameters

text string

Returns

FirewallPortSpec

TcpPort(int)

A single TCP port.

public static FirewallPortSpec TcpPort(int port)

Parameters

port int

Returns

FirewallPortSpec

ToString()

Canonical form: 443/tcp or 7770-7999/udp.

public override string ToString()

Returns

string