summaryrefslogtreecommitdiffstats
path: root/modules/websocket/websocket_multiplayer_peer.h
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-01-20 01:51:35 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-01-28 11:08:02 +0100
commitadba870534bdcdd11f0f344e66090be8e2cd9ae4 (patch)
tree90a82a28e69cf61b10f210cd02d086cdeb410d95 /modules/websocket/websocket_multiplayer_peer.h
parent2afa175195d0fc885badb60441bef1b31e5e6d05 (diff)
downloadredot-engine-adba870534bdcdd11f0f344e66090be8e2cd9ae4.tar.gz
[NET] Refactor TLS configuration.
Use a TLSOptions configuration object which is created via static functions. - "TLSOptions.client": uses the standard CA and common name verification. - "TLSOptions.client_unsafe": uses optional CA verification (i.e. if specified) - "TLSOptions.server": is the standard server configuration (chain + key) This will allow us to expand the TLS configuration options to include e.g. mutual authentication without bloating the classes that uses StreamPeerTLS and PacketPeerDTLS as underlying peers.
Diffstat (limited to 'modules/websocket/websocket_multiplayer_peer.h')
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index ea10e8799f..22f1bc939b 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -71,9 +71,7 @@ protected:
Ref<WebSocketPeer> peer_config;
HashMap<int, PendingPeer> pending_peers;
Ref<TCPServer> tcp_server;
- bool use_tls = false;
- Ref<X509Certificate> tls_certificate;
- Ref<CryptoKey> tls_key;
+ Ref<TLSOptions> tls_server_options;
ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
@@ -115,8 +113,8 @@ public:
/* WebSocketPeer */
virtual Ref<WebSocketPeer> get_peer(int p_peer_id) const;
- Error create_client(const String &p_url, bool p_verify_tls, Ref<X509Certificate> p_tls_certificate);
- Error create_server(int p_port, IPAddress p_bind_ip, Ref<CryptoKey> p_tls_key, Ref<X509Certificate> p_tls_certificate);
+ Error create_client(const String &p_url, Ref<TLSOptions> p_options);
+ Error create_server(int p_port, IPAddress p_bind_ip, Ref<TLSOptions> p_options);
void set_supported_protocols(const Vector<String> &p_protocols);
Vector<String> get_supported_protocols() const;