TLSOptions

package
v0.0.0-...-c858641 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

TLSOptions abstracts the configuration options for the graphics.gd/classdb/StreamPeerTLS and graphics.gd/classdb/PacketPeerDTLS classes.

Objects of this class cannot be instantiated directly, and one of the static methods Client, ClientUnsafe, or Server should be used instead.

package main

import (
	"graphics.gd/classdb/Resource"
	"graphics.gd/classdb/TLSOptions"
	"graphics.gd/classdb/X509Certificate"
)

func ExampleTLSOptions() {
	var client_trusted_cas = Resource.Load[X509Certificate.Instance]("res://my_trusted_cas.crt")
	var client_tls_options = TLSOptions.Client(client_trusted_cas, "")
	_ = client_tls_options
}

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
	AsTLSOptions() Instance
}

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]) AsRefCounted

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

func (*Extension[T]) AsTLSOptions

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

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.TLSOptions

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 Client

func Client(trusted_chain X509Certificate.Instance, common_name_override string) Instance

Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names).

You can specify a custom 'trusted_chain' of certification authorities (the default CA list will be used if null), and optionally provide a 'common_name_override' if you expect the certificate to have a common name other than the server FQDN.

Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.

func ClientOptions

func ClientOptions(trusted_chain X509Certificate.Instance, common_name_override string) Instance

Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names).

You can specify a custom 'trusted_chain' of certification authorities (the default CA list will be used if null), and optionally provide a 'common_name_override' if you expect the certificate to have a common name other than the server FQDN.

Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.

func ClientUnsafe

func ClientUnsafe(trusted_chain X509Certificate.Instance) Instance

Creates an unsafe TLS client configuration where certificate validation is optional. You can optionally provide a valid 'trusted_chain', but the common name of the certificates will never be checked. Using this configuration for purposes other than testing is not recommended.

Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.

func ClientUnsafeOptions

func ClientUnsafeOptions(trusted_chain X509Certificate.Instance) Instance

Creates an unsafe TLS client configuration where certificate validation is optional. You can optionally provide a valid 'trusted_chain', but the common name of the certificates will never be checked. Using this configuration for purposes other than testing is not recommended.

Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.

func New

func New() Instance

func Server

func Server(key CryptoKey.Instance, certificate X509Certificate.Instance) Instance

Creates a TLS server configuration using the provided 'key' and 'certificate'.

Note: The 'certificate' should include the full certificate chain up to the signing CA (certificates file can be concatenated using a general purpose text editor).

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) AsTLSOptions

func (self Instance) AsTLSOptions() Instance

func (Instance) GetCommonNameOverride

func (self Instance) GetCommonNameOverride() string

Returns the common name (domain name) override specified when creating with graphics.gd/classdb/TLSOptions.Instance.Client.

func (Instance) GetOwnCertificate

func (self Instance) GetOwnCertificate() X509Certificate.Instance

Returns the graphics.gd/classdb/X509Certificate specified when creating with graphics.gd/classdb/TLSOptions.Instance.Server.

func (Instance) GetPrivateKey

func (self Instance) GetPrivateKey() CryptoKey.Instance

Returns the graphics.gd/classdb/CryptoKey specified when creating with graphics.gd/classdb/TLSOptions.Instance.Server.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsServer

func (self Instance) IsServer() bool

Returns true if created with graphics.gd/classdb/TLSOptions.Instance.Server, false otherwise.

func (Instance) IsUnsafeClient

func (self Instance) IsUnsafeClient() bool

Returns true if created with graphics.gd/classdb/TLSOptions.Instance.ClientUnsafe, false otherwise.

func (*Instance) SetObject

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

func (Instance) Virtual

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

Jump to

Keyboard shortcuts

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