Skip to content

Commit

Permalink
feat: ThreadedEncryptionKcpTransport (#3933)
Browse files Browse the repository at this point in the history
* code style

* feat: ThreadedEncryptionTransport

* Threaded Encryption Kcp

* older c# support
  • Loading branch information
imerr authored Nov 25, 2024
1 parent a06d076 commit 26049d9
Show file tree
Hide file tree
Showing 8 changed files with 622 additions and 392 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void Setup()
GameObject gameObject = new GameObject();

encryption = gameObject.AddComponent<EncryptionTransport>();
encryption.inner = inner;
encryption.Inner = inner;
}

[TearDown]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@ public class EncryptionTransportInspector : UnityEditor.Editor

void OnEnable()
{
innerProperty = serializedObject.FindProperty("inner");
clientValidatesServerPubKeyProperty = serializedObject.FindProperty("clientValidateServerPubKey");
clientTrustedPubKeySignaturesProperty = serializedObject.FindProperty("clientTrustedPubKeySignatures");
serverKeypairPathProperty = serializedObject.FindProperty("serverKeypairPath");
serverLoadKeyPairFromFileProperty = serializedObject.FindProperty("serverLoadKeyPairFromFile");
innerProperty = serializedObject.FindProperty("Inner");
clientValidatesServerPubKeyProperty = serializedObject.FindProperty("ClientValidateServerPubKey");
clientTrustedPubKeySignaturesProperty = serializedObject.FindProperty("ClientTrustedPubKeySignatures");
serverKeypairPathProperty = serializedObject.FindProperty("ServerKeypairPath");
serverLoadKeyPairFromFileProperty = serializedObject.FindProperty("ServerLoadKeyPairFromFile");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.LabelField("Common", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(innerProperty);
EditorGUILayout.Separator();
// Draw default inspector for the parent class
DrawDefaultInspector();
EditorGUILayout.LabelField("Encryption Settings", EditorStyles.boldLabel);
if (innerProperty != null)
{
EditorGUILayout.LabelField("Common", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(innerProperty);
EditorGUILayout.Separator();
}
// Client Section
EditorGUILayout.LabelField("Client", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Validating the servers public key is essential for complete man-in-the-middle (MITM) safety, but might not be feasible for all modes of hosting.", MessageType.Info);
Expand Down Expand Up @@ -77,5 +83,8 @@ public override void OnInspectorGUI()

serializedObject.ApplyModifiedProperties();
}

[CustomEditor(typeof(ThreadedEncryptionKcpTransport), true)]
class EncryptionThreadedTransportInspector : EncryptionTransportInspector {}
}
}
Loading

0 comments on commit 26049d9

Please sign in to comment.