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.