2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 00:44:37 +00:00
<class name= "StreamPeerTLS" inherits= "StreamPeer" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2023-04-27 23:35:33 +00:00
A stream peer that handles TLS connections.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2023-04-27 23:35:33 +00:00
A stream peer that handles TLS connections. This object can be used to connect to a TLS server or accept a single TLS client connection.
2021-08-10 15:47:09 +00:00
[b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2022-09-07 06:25:47 +00:00
<link title= "TLS certificates" > $DOCS_URL/tutorials/networking/ssl_certificates.html</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
<method name= "accept_stream" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "stream" type= "StreamPeer" />
2023-01-20 00:51:35 +00:00
<param index= "1" name= "server_options" type= "TLSOptions" />
2017-09-12 20:42:36 +00:00
<description >
2023-01-20 00:51:35 +00:00
Accepts a peer connection as a server using the given [param server_options]. See [method TLSOptions.server].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "connect_to_stream" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "stream" type= "StreamPeer" />
2023-01-20 00:51:35 +00:00
<param index= "1" name= "common_name" type= "String" />
<param index= "2" name= "client_options" type= "TLSOptions" default= "null" />
2017-09-12 20:42:36 +00:00
<description >
2023-01-30 13:22:47 +00:00
Connects to a peer using an underlying [StreamPeer] [param stream] and verifying the remote certificate is correctly signed for the given [param common_name]. You can pass the optional [param client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "disconnect_from_stream" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
Disconnects from host.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_status" qualifiers= "const" >
2022-09-06 22:46:12 +00:00
<return type= "int" enum= "StreamPeerTLS.Status" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
Returns the status of the connection. See [enum Status] for values.
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-05-23 22:07:44 +00:00
<method name= "get_stream" qualifiers= "const" >
<return type= "StreamPeer" />
<description >
Returns the underlying [StreamPeer] connection, used in [method accept_stream] or [method connect_to_stream].
</description>
</method>
2018-02-09 14:03:34 +00:00
<method name= "poll" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2018-02-09 14:03:34 +00:00
<description >
2019-06-21 23:04:47 +00:00
Poll the connection to check for incoming bytes. Call this right before [method StreamPeer.get_available_bytes] for it to work properly.
2018-02-09 14:03:34 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
</methods>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "STATUS_DISCONNECTED" value= "0" enum= "Status" >
2022-09-06 22:46:12 +00:00
A status representing a [StreamPeerTLS] that is disconnected.
2017-09-12 20:42:36 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "STATUS_HANDSHAKING" value= "1" enum= "Status" >
2022-09-06 22:46:12 +00:00
A status representing a [StreamPeerTLS] during handshaking.
2018-10-07 13:52:07 +00:00
</constant>
2018-07-26 09:56:21 +00:00
<constant name= "STATUS_CONNECTED" value= "2" enum= "Status" >
2022-09-06 22:46:12 +00:00
A status representing a [StreamPeerTLS] that is connected to a host.
2017-09-12 20:42:36 +00:00
</constant>
2018-07-26 09:56:21 +00:00
<constant name= "STATUS_ERROR" value= "3" enum= "Status" >
2022-09-06 22:46:12 +00:00
A status representing a [StreamPeerTLS] in error state.
2017-09-12 20:42:36 +00:00
</constant>
2018-07-26 09:56:21 +00:00
<constant name= "STATUS_ERROR_HOSTNAME_MISMATCH" value= "4" enum= "Status" >
2022-09-07 06:25:47 +00:00
An error status that shows a mismatch in the TLS certificate domain presented by the host and the domain requested for validation.
2017-09-12 20:42:36 +00:00
</constant>
</constants>
</class>