| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="StreamPeerTLS" inherits="StreamPeer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A stream peer that handles TLS connections. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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. |
| 8 | [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. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | <link title="TLS certificates">$DOCS_URL/tutorials/networking/ssl_certificates.html</link> |
| 12 | </tutorials> |
| 13 | <methods> |
| 14 | <method name="accept_stream"> |
| 15 | <return type="int" enum="Error" /> |
| 16 | <param index="0" name="stream" type="StreamPeer" /> |
| 17 | <param index="1" name="server_options" type="TLSOptions" /> |
| 18 | <description> |
| 19 | Accepts a peer connection as a server using the given [param server_options]. See [method TLSOptions.server]. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="connect_to_stream"> |
| 23 | <return type="int" enum="Error" /> |
| 24 | <param index="0" name="stream" type="StreamPeer" /> |
| 25 | <param index="1" name="common_name" type="String" /> |
| 26 | <param index="2" name="client_options" type="TLSOptions" default="null" /> |
| 27 | <description> |
| 28 | 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]. |
| 29 | </description> |
| 30 | </method> |
| 31 | <method name="disconnect_from_stream"> |
| 32 | <return type="void" /> |
| 33 | <description> |
| 34 | Disconnects from host. |
| 35 | </description> |
| 36 | </method> |
| 37 | <method name="get_status" qualifiers="const"> |
| 38 | <return type="int" enum="StreamPeerTLS.Status" /> |
| 39 | <description> |
| 40 | Returns the status of the connection. |
| 41 | </description> |
| 42 | </method> |
| 43 | <method name="get_stream" qualifiers="const"> |
| 44 | <return type="StreamPeer" /> |
| 45 | <description> |
| 46 | Returns the underlying [StreamPeer] connection, used in [method accept_stream] or [method connect_to_stream]. |
| 47 | </description> |
| 48 | </method> |
| 49 | <method name="poll"> |
| 50 | <return type="void" /> |
| 51 | <description> |
| 52 | Poll the connection to check for incoming bytes. Call this right before [method StreamPeer.get_available_bytes] for it to work properly. |
| 53 | </description> |
| 54 | </method> |
| 55 | </methods> |
| 56 | <constants> |
| 57 | <constant name="STATUS_DISCONNECTED" value="0" enum="Status"> |
| 58 | A status representing a [StreamPeerTLS] that is disconnected. |
| 59 | </constant> |
| 60 | <constant name="STATUS_HANDSHAKING" value="1" enum="Status"> |
| 61 | A status representing a [StreamPeerTLS] during handshaking. |
| 62 | </constant> |
| 63 | <constant name="STATUS_CONNECTED" value="2" enum="Status"> |
| 64 | A status representing a [StreamPeerTLS] that is connected to a host. |
| 65 | </constant> |
| 66 | <constant name="STATUS_ERROR" value="3" enum="Status"> |
| 67 | A status representing a [StreamPeerTLS] in error state. |
| 68 | </constant> |
| 69 | <constant name="STATUS_ERROR_HOSTNAME_MISMATCH" value="4" enum="Status"> |
| 70 | An error status that shows a mismatch in the TLS certificate domain presented by the host and the domain requested for validation. |
| 71 | </constant> |
| 72 | </constants> |
| 73 | </class> |