class_streampeerssl.rst 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/StreamPeerSSL.xml.
  6. .. _class_StreamPeerSSL:
  7. StreamPeerSSL
  8. =============
  9. **Inherits:** :ref:`StreamPeer<class_StreamPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. SSL stream peer.
  11. Description
  12. -----------
  13. SSL stream peer. This object can be used to connect to an SSL server or accept a single SSL client connection.
  14. \ **Note:** When exporting to Android, make sure to enable the ``INTERNET`` 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.
  15. Tutorials
  16. ---------
  17. - :doc:`SSL certificates <../tutorials/networking/ssl_certificates>`
  18. Properties
  19. ----------
  20. +-------------------------+----------------------------------------------------------------------------+----------+
  21. | :ref:`bool<class_bool>` | :ref:`blocking_handshake<class_StreamPeerSSL_property_blocking_handshake>` | ``true`` |
  22. +-------------------------+----------------------------------------------------------------------------+----------+
  23. Methods
  24. -------
  25. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`accept_stream<class_StreamPeerSSL_method_accept_stream>` **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`CryptoKey<class_CryptoKey>` private_key, :ref:`X509Certificate<class_X509Certificate>` certificate, :ref:`X509Certificate<class_X509Certificate>` chain=null **)** |
  27. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_to_stream<class_StreamPeerSSL_method_connect_to_stream>` **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`bool<class_bool>` validate_certs=false, :ref:`String<class_String>` for_hostname="", :ref:`X509Certificate<class_X509Certificate>` valid_certificate=null **)** |
  29. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`disconnect_from_stream<class_StreamPeerSSL_method_disconnect_from_stream>` **(** **)** |
  31. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Status<enum_StreamPeerSSL_Status>` | :ref:`get_status<class_StreamPeerSSL_method_get_status>` **(** **)** |const| |
  33. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`StreamPeer<class_StreamPeer>` | :ref:`get_stream<class_StreamPeerSSL_method_get_stream>` **(** **)** |const| |
  35. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`poll<class_StreamPeerSSL_method_poll>` **(** **)** |
  37. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. Enumerations
  39. ------------
  40. .. _enum_StreamPeerSSL_Status:
  41. .. _class_StreamPeerSSL_constant_STATUS_DISCONNECTED:
  42. .. _class_StreamPeerSSL_constant_STATUS_HANDSHAKING:
  43. .. _class_StreamPeerSSL_constant_STATUS_CONNECTED:
  44. .. _class_StreamPeerSSL_constant_STATUS_ERROR:
  45. .. _class_StreamPeerSSL_constant_STATUS_ERROR_HOSTNAME_MISMATCH:
  46. enum **Status**:
  47. - **STATUS_DISCONNECTED** = **0** --- A status representing a ``StreamPeerSSL`` that is disconnected.
  48. - **STATUS_HANDSHAKING** = **1** --- A status representing a ``StreamPeerSSL`` during handshaking.
  49. - **STATUS_CONNECTED** = **2** --- A status representing a ``StreamPeerSSL`` that is connected to a host.
  50. - **STATUS_ERROR** = **3** --- A status representing a ``StreamPeerSSL`` in error state.
  51. - **STATUS_ERROR_HOSTNAME_MISMATCH** = **4** --- An error status that shows a mismatch in the SSL certificate domain presented by the host and the domain requested for validation.
  52. Property Descriptions
  53. ---------------------
  54. .. _class_StreamPeerSSL_property_blocking_handshake:
  55. - :ref:`bool<class_bool>` **blocking_handshake**
  56. +-----------+---------------------------------------+
  57. | *Default* | ``true`` |
  58. +-----------+---------------------------------------+
  59. | *Setter* | set_blocking_handshake_enabled(value) |
  60. +-----------+---------------------------------------+
  61. | *Getter* | is_blocking_handshake_enabled() |
  62. +-----------+---------------------------------------+
  63. Method Descriptions
  64. -------------------
  65. .. _class_StreamPeerSSL_method_accept_stream:
  66. - :ref:`Error<enum_@GlobalScope_Error>` **accept_stream** **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`CryptoKey<class_CryptoKey>` private_key, :ref:`X509Certificate<class_X509Certificate>` certificate, :ref:`X509Certificate<class_X509Certificate>` chain=null **)**
  67. Accepts a peer connection as a server using the given ``private_key`` and providing the given ``certificate`` to the client. You can pass the optional ``chain`` parameter to provide additional CA chain information along with the certificate.
  68. ----
  69. .. _class_StreamPeerSSL_method_connect_to_stream:
  70. - :ref:`Error<enum_@GlobalScope_Error>` **connect_to_stream** **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`bool<class_bool>` validate_certs=false, :ref:`String<class_String>` for_hostname="", :ref:`X509Certificate<class_X509Certificate>` valid_certificate=null **)**
  71. Connects to a peer using an underlying :ref:`StreamPeer<class_StreamPeer>` ``stream``. If ``validate_certs`` is ``true``, ``StreamPeerSSL`` will validate that the certificate presented by the peer matches the ``for_hostname``.
  72. \ **Note:** Specifying a custom ``valid_certificate`` is not supported in HTML5 exports due to browsers restrictions.
  73. ----
  74. .. _class_StreamPeerSSL_method_disconnect_from_stream:
  75. - void **disconnect_from_stream** **(** **)**
  76. Disconnects from host.
  77. ----
  78. .. _class_StreamPeerSSL_method_get_status:
  79. - :ref:`Status<enum_StreamPeerSSL_Status>` **get_status** **(** **)** |const|
  80. Returns the status of the connection. See :ref:`Status<enum_StreamPeerSSL_Status>` for values.
  81. ----
  82. .. _class_StreamPeerSSL_method_get_stream:
  83. - :ref:`StreamPeer<class_StreamPeer>` **get_stream** **(** **)** |const|
  84. Returns the underlying :ref:`StreamPeer<class_StreamPeer>` connection, used in :ref:`accept_stream<class_StreamPeerSSL_method_accept_stream>` or :ref:`connect_to_stream<class_StreamPeerSSL_method_connect_to_stream>`.
  85. ----
  86. .. _class_StreamPeerSSL_method_poll:
  87. - void **poll** **(** **)**
  88. Poll the connection to check for incoming bytes. Call this right before :ref:`StreamPeer.get_available_bytes<class_StreamPeer_method_get_available_bytes>` for it to work properly.
  89. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  90. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  91. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  92. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  93. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  94. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`