CmdField: Less allocations.
MODIFY
WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/CmdField.cs
WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/CmdField.cs
@@ -4,16 +4,11 @@ namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields
{
public class CmdField : OctetSerializableBase
{
- public CmdField(byte byteValue)
- {
- ByteValue = byteValue;
- }
-
// https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt
// The BIND command is not supported.
// The (SOCKS5) "UDP ASSOCIATE" command is not supported.
- public static CmdField Connect => new CmdField(0x01);
+ public static readonly CmdField Connect = new CmdField(0x01);
// https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt#n46
// As an extension to SOCKS4A and SOCKS5, Tor implements a new command value,
@@ -22,7 +17,7 @@ namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields
// request.The reply is either an error(if the address could not be
// resolved) or a success response.In the case of success, the address is
// stored in the portion of the SOCKS response reserved for remote IP address.
- public static CmdField Resolve => new CmdField(0xF0);
+ public static readonly CmdField Resolve = new CmdField(0xF0);
// https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt#n55
// For SOCKS5 only, we support reverse resolution with a new command value,
@@ -30,6 +25,11 @@ namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields
// an IPv4 address as its target, Tor attempts to find the canonical
// hostname for that IPv4 record, and returns it in the "server bound
// address" portion of the reply.
- public static CmdField ResolvePtr => new CmdField(0xF1);
+ public static readonly CmdField ResolvePtr = new CmdField(0xF1);
+
+ public CmdField(byte byteValue)
+ {
+ ByteValue = byteValue;
+ }
}
}

CmdField: Less allocations.