PacketPeerDTLS

package
v0.0.0-...-535787f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

This class represents a DTLS peer connection. It can be used to connect to a DTLS server, and is returned by graphics.gd/classdb/DTLSServer.Instance.TakeConnection.

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.

Warning: TLS certificate revocation and certificate pinning are currently not supported. Revoked certificates are accepted as long as they are otherwise valid. If this is a concern, you may want to use automatically managed certificates with a short validity period.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsPacketPeerDTLS() Instance
}

type Expanded

type Expanded [1]gdclass.PacketPeerDTLS

func (Expanded) ConnectToPeer

func (self Expanded) ConnectToPeer(packet_peer PacketPeerUDP.Instance, hostname string, client_options TLSOptions.Instance) error

Connects a 'packet_peer' beginning the DTLS handshake using the underlying graphics.gd/classdb/PacketPeerUDP which must be connected (see graphics.gd/classdb/PacketPeerUDP.Instance.ConnectToHost). You can optionally specify the 'client_options' to be used while verifying the TLS connections. See graphics.gd/classdb/TLSOptions.Instance.Client and graphics.gd/classdb/TLSOptions.Instance.ClientUnsafe.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsPacketPeer

func (self *Extension[T]) AsPacketPeer() PacketPeer.Instance

func (*Extension[T]) AsPacketPeerDTLS

func (self *Extension[T]) AsPacketPeerDTLS() Instance

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.PacketPeerDTLS

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsPacketPeer

func (self Instance) AsPacketPeer() PacketPeer.Instance

func (Instance) AsPacketPeerDTLS

func (self Instance) AsPacketPeerDTLS() Instance

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) ConnectToPeer

func (self Instance) ConnectToPeer(packet_peer PacketPeerUDP.Instance, hostname string) error

Connects a 'packet_peer' beginning the DTLS handshake using the underlying graphics.gd/classdb/PacketPeerUDP which must be connected (see graphics.gd/classdb/PacketPeerUDP.Instance.ConnectToHost). You can optionally specify the 'client_options' to be used while verifying the TLS connections. See graphics.gd/classdb/TLSOptions.Instance.Client and graphics.gd/classdb/TLSOptions.Instance.ClientUnsafe.

func (Instance) DisconnectFromPeer

func (self Instance) DisconnectFromPeer()

Disconnects this peer, terminating the DTLS session.

func (Instance) GetStatus

func (self Instance) GetStatus() Status

Returns the status of the connection.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Poll

func (self Instance) Poll()

Poll the connection to check for incoming packets. Call this frequently to update the status and keep the connection working.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Status

type Status int //gd:PacketPeerDTLS.Status
const (
	// A status representing a [graphics.gd/classdb/PacketPeerDTLS] that is disconnected.
	StatusDisconnected Status = 0
	// A status representing a [graphics.gd/classdb/PacketPeerDTLS] that is currently performing the handshake with a remote peer.
	StatusHandshaking Status = 1
	// A status representing a [graphics.gd/classdb/PacketPeerDTLS] that is connected to a remote peer.
	StatusConnected Status = 2
	// A status representing a [graphics.gd/classdb/PacketPeerDTLS] in a generic error state.
	StatusError Status = 3
	// An error status that shows a mismatch in the DTLS certificate domain presented by the host and the domain requested for validation.
	StatusErrorHostnameMismatch Status = 4
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL