From 4dd3f1e71d16d8f47b30a4d390c0cfe16ba727c2 Mon Sep 17 00:00:00 2001 From: "Michael W." Date: Fri, 11 Oct 2024 15:21:02 +0200 Subject: [PATCH] fix(EncryptionTransport): implement PortTransport --- .../Encryption/EncryptionTransport.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs b/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs index b9d1b9d12..d749f08a6 100644 --- a/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs +++ b/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs @@ -7,12 +7,35 @@ namespace Mirror.Transports.Encryption { [HelpURL("https://mirror-networking.gitbook.io/docs/manual/transports/encryption-transport")] - public class EncryptionTransport : Transport + public class EncryptionTransport : Transport, PortTransport { public override bool IsEncrypted => true; public override string EncryptionCipher => "AES256-GCM"; public Transport inner; + public ushort Port + { + get + { + if (inner is PortTransport portTransport) + { + return portTransport.Port; + } + + Debug.LogError($"EncryptionTransport can't get Port because {inner} is not a PortTransport"); + return 0; + } + set + { + if (inner is PortTransport portTransport) + { + portTransport.Port = value; + return; + } + Debug.LogError($"EncryptionTransport can't set Port because {inner} is not a PortTransport"); + } + } + public enum ValidationMode { Off,