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
Fields
Tcp
public const string Tcp = "tcp"
Field Value
Udp
public const string Udp = "udp"
Field Value
Properties
From
First port in the range (inclusive).
public int From { get; }
Property Value
IsRange
True when this spec covers more than one port.
public bool IsRange { get; }
Property Value
PortText
Port text without protocol, hyphenated for ranges (7770-7999).
public string PortText { get; }
Property Value
Protocol
Lower-case protocol: tcp or udp.
public string Protocol { get; }
Property Value
To
Last port in the range (inclusive). Equals From for a single port.
public int To { get; }
Property Value
UfwPortText
Port text using the ufw range separator (7770:7999).
public string UfwPortText { get; }
Property Value
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
textstring
Returns
TcpPort(int)
A single TCP port.
public static FirewallPortSpec TcpPort(int port)
Parameters
portint
Returns
ToString()
Canonical form: 443/tcp or 7770-7999/udp.
public override string ToString()