class_streampeertls.rst 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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/StreamPeerTLS.xml.
  6. .. _class_StreamPeerTLS:
  7. StreamPeerTLS
  8. =============
  9. **Inherits:** :ref:`StreamPeer<class_StreamPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A stream peer that handles TLS connections.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. \ **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.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`TLS certificates <../tutorials/networking/ssl_certificates>`
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`accept_stream<class_StreamPeerTLS_method_accept_stream>` **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`TLSOptions<class_TLSOptions>` server_options **)** |
  27. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_to_stream<class_StreamPeerTLS_method_connect_to_stream>` **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`String<class_String>` common_name, :ref:`TLSOptions<class_TLSOptions>` client_options=null **)** |
  29. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`disconnect_from_stream<class_StreamPeerTLS_method_disconnect_from_stream>` **(** **)** |
  31. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Status<enum_StreamPeerTLS_Status>` | :ref:`get_status<class_StreamPeerTLS_method_get_status>` **(** **)** |const| |
  33. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`StreamPeer<class_StreamPeer>` | :ref:`get_stream<class_StreamPeerTLS_method_get_stream>` **(** **)** |const| |
  35. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`poll<class_StreamPeerTLS_method_poll>` **(** **)** |
  37. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. .. rst-class:: classref-section-separator
  39. ----
  40. .. rst-class:: classref-descriptions-group
  41. Enumerations
  42. ------------
  43. .. _enum_StreamPeerTLS_Status:
  44. .. rst-class:: classref-enumeration
  45. enum **Status**:
  46. .. _class_StreamPeerTLS_constant_STATUS_DISCONNECTED:
  47. .. rst-class:: classref-enumeration-constant
  48. :ref:`Status<enum_StreamPeerTLS_Status>` **STATUS_DISCONNECTED** = ``0``
  49. A status representing a **StreamPeerTLS** that is disconnected.
  50. .. _class_StreamPeerTLS_constant_STATUS_HANDSHAKING:
  51. .. rst-class:: classref-enumeration-constant
  52. :ref:`Status<enum_StreamPeerTLS_Status>` **STATUS_HANDSHAKING** = ``1``
  53. A status representing a **StreamPeerTLS** during handshaking.
  54. .. _class_StreamPeerTLS_constant_STATUS_CONNECTED:
  55. .. rst-class:: classref-enumeration-constant
  56. :ref:`Status<enum_StreamPeerTLS_Status>` **STATUS_CONNECTED** = ``2``
  57. A status representing a **StreamPeerTLS** that is connected to a host.
  58. .. _class_StreamPeerTLS_constant_STATUS_ERROR:
  59. .. rst-class:: classref-enumeration-constant
  60. :ref:`Status<enum_StreamPeerTLS_Status>` **STATUS_ERROR** = ``3``
  61. A status representing a **StreamPeerTLS** in error state.
  62. .. _class_StreamPeerTLS_constant_STATUS_ERROR_HOSTNAME_MISMATCH:
  63. .. rst-class:: classref-enumeration-constant
  64. :ref:`Status<enum_StreamPeerTLS_Status>` **STATUS_ERROR_HOSTNAME_MISMATCH** = ``4``
  65. An error status that shows a mismatch in the TLS certificate domain presented by the host and the domain requested for validation.
  66. .. rst-class:: classref-section-separator
  67. ----
  68. .. rst-class:: classref-descriptions-group
  69. Method Descriptions
  70. -------------------
  71. .. _class_StreamPeerTLS_method_accept_stream:
  72. .. rst-class:: classref-method
  73. :ref:`Error<enum_@GlobalScope_Error>` **accept_stream** **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`TLSOptions<class_TLSOptions>` server_options **)**
  74. Accepts a peer connection as a server using the given ``server_options``. See :ref:`TLSOptions.server<class_TLSOptions_method_server>`.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_StreamPeerTLS_method_connect_to_stream:
  78. .. rst-class:: classref-method
  79. :ref:`Error<enum_@GlobalScope_Error>` **connect_to_stream** **(** :ref:`StreamPeer<class_StreamPeer>` stream, :ref:`String<class_String>` common_name, :ref:`TLSOptions<class_TLSOptions>` client_options=null **)**
  80. Connects to a peer using an underlying :ref:`StreamPeer<class_StreamPeer>` ``stream`` and verifying the remote certificate is correctly signed for the given ``common_name``. You can pass the optional ``client_options`` parameter to customize the trusted certification authorities, or disable the common name verification. See :ref:`TLSOptions.client<class_TLSOptions_method_client>` and :ref:`TLSOptions.client_unsafe<class_TLSOptions_method_client_unsafe>`.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_StreamPeerTLS_method_disconnect_from_stream:
  84. .. rst-class:: classref-method
  85. void **disconnect_from_stream** **(** **)**
  86. Disconnects from host.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_StreamPeerTLS_method_get_status:
  90. .. rst-class:: classref-method
  91. :ref:`Status<enum_StreamPeerTLS_Status>` **get_status** **(** **)** |const|
  92. Returns the status of the connection. See :ref:`Status<enum_StreamPeerTLS_Status>` for values.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_StreamPeerTLS_method_get_stream:
  96. .. rst-class:: classref-method
  97. :ref:`StreamPeer<class_StreamPeer>` **get_stream** **(** **)** |const|
  98. Returns the underlying :ref:`StreamPeer<class_StreamPeer>` connection, used in :ref:`accept_stream<class_StreamPeerTLS_method_accept_stream>` or :ref:`connect_to_stream<class_StreamPeerTLS_method_connect_to_stream>`.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_StreamPeerTLS_method_poll:
  102. .. rst-class:: classref-method
  103. void **poll** **(** **)**
  104. 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.
  105. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  106. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  107. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  108. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  109. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  110. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  111. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`