How does DTLS work for high level multiplayer in godot 4
Asked Answered
P

2

0

I have been trying to test DTLS for a networking project I am working on, but I have not been able to find any tutorials for it so far.
After looking through the documentation, my best guess looks like this

network = ENetMultiplayerPeer.new()
network.create_client(DEFAULT_ADDRESS, DEFAULT_PORT)
network.host.dtls_client_setup("hostname", TLSOptions.client(cert))
multiplayer.multiplayer_peer = network

for the client, and

network = ENetMultiplayerPeer.new()
network.create_server(DEFAULT_PORT, MAX_PLAYERS)
network.host.dtls_server_setup(TLSOptions.server(key, cert))
multiplayer.multiplayer_peer = network

for the server.

For testing purposes I am making my own crypto key and x509 certificate, and for the hostname part of dtls client setup I have what I put for the common name in the certificate. Is this right?
Currently everything is working as expected but how can I tell that the datagrams are actually being encrypted?
If someone could verify that this is the way I am supposed to do it, I would greatly appreciate it.

Profit answered 25/6, 2023 at 7:50 Comment(0)
W
0

If you realy want it secure you should consider using a packet sniffer to validate the encrption ... something like wireshark

Wakerife answered 25/6, 2023 at 19:47 Comment(0)
P
0

Wakerife very helpful advice. With wireshark it was very easy to look at the communications on a port, and I was able to determine that the connection was actually encrypted.

Profit answered 27/6, 2023 at 5:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.