SimpleWebTransport: moved overrides down

This commit is contained in:
MrGadget 2024-03-07 07:57:22 -05:00
parent 1a915ccde7
commit f10bc77195

View File

@ -13,9 +13,6 @@ public class SimpleWebTransport : Transport, PortTransport
public const string NormalScheme = "ws";
public const string SecureScheme = "wss";
public override bool IsEncrypted => ClientConnected() && (clientUseWss || sslEnabled) || ServerActive() && sslEnabled;
public override string EncryptionCipher => "TLS"; // not technically correct, but there's no good way to get the actual cipher. Especially in browser
[Tooltip("Protect against allocation attacks by keeping the max message size small. Otherwise an attacker might send multiple fake packets with 2GB headers, causing the server to run out of memory after allocating multiple large packets.")]
public int maxMessageSize = 16 * 1024;
@ -147,6 +144,12 @@ public override void Shutdown()
string GetClientScheme() => (sslEnabled || clientUseWss) ? SecureScheme : NormalScheme;
public override bool IsEncrypted => ClientConnected() && (clientUseWss || sslEnabled) || ServerActive() && sslEnabled;
// Not technically correct, but there's no good way to get the actual cipher, especially in browser
// When using reverse proxy, connection between proxy and server is not encrypted.
public override string EncryptionCipher => "TLS";
public override bool ClientConnected()
{
// not null and not NotConnected (we want to return true if connecting or disconnecting)