v0.2.1 c0399be

gtlsclientconnection.go RawHistoryFolder

1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// vtable for a #GTlsClientConnection implementation.
17type TlsClientConnectionInterface struct {
18	_ structs.HostLayout
19
20	GIface uintptr
21
22	xCopySessionState uintptr
23}
24
25func (x *TlsClientConnectionInterface) GoPointer() uintptr {
26	return uintptr(unsafe.Pointer(x))
27}
28
29// OverrideCopySessionState sets the "copy_session_state" callback function.
30// Copies session state from one #GTlsClientConnection to another.
31func (x *TlsClientConnectionInterface) OverrideCopySessionState(cb func(TlsClientConnection, TlsClientConnection)) {
32	if cb == nil {
33		x.xCopySessionState = 0
34	} else {
35		x.xCopySessionState = purego.NewCallback(func(ConnVarp uintptr, SourceVarp uintptr) {
36			cb(&TlsClientConnectionBase{Ptr: ConnVarp}, &TlsClientConnectionBase{Ptr: SourceVarp})
37		})
38	}
39}
40
41// GetCopySessionState gets the "copy_session_state" callback function.
42// Copies session state from one #GTlsClientConnection to another.
43func (x *TlsClientConnectionInterface) GetCopySessionState() func(TlsClientConnection, TlsClientConnection) {
44	if x.xCopySessionState == 0 {
45		return nil
46	}
47	var rawCallback func(ConnVarp uintptr, SourceVarp uintptr)
48	purego.RegisterFunc(&rawCallback, x.xCopySessionState)
49	return func(ConnVar TlsClientConnection, SourceVar TlsClientConnection) {
50		rawCallback(ConnVar.GoPointer(), SourceVar.GoPointer())
51	}
52}
53
54// `GTlsClientConnection` is the client-side subclass of
55// [class@Gio.TlsConnection], representing a client-side TLS connection.
56type TlsClientConnection interface {
57	GoPointer() uintptr
58	SetGoPointer(uintptr)
59	CopySessionState(SourceVar TlsClientConnection)
60	GetAcceptedCas() *glib.List
61	GetServerIdentity() *SocketConnectableBase
62	GetUseSsl3() bool
63	GetValidationFlags() TlsCertificateFlags
64	SetServerIdentity(IdentityVar SocketConnectable)
65	SetUseSsl3(UseSsl3Var bool)
66	SetValidationFlags(FlagsVar TlsCertificateFlags)
67}
68
69var xTlsClientConnectionGLibType func() types.GType
70
71func TlsClientConnectionGLibType() types.GType {
72	return xTlsClientConnectionGLibType()
73}
74
75type TlsClientConnectionBase struct {
76	Ptr uintptr
77}
78
79func (x *TlsClientConnectionBase) GoPointer() uintptr {
80	if x == nil {
81		return 0
82	}
83	return x.Ptr
84}
85
86func (x *TlsClientConnectionBase) SetGoPointer(ptr uintptr) {
87	x.Ptr = ptr
88}
89
90// Possibly copies session state from one connection to another, for use
91// in TLS session resumption. This is not normally needed, but may be
92// used when the same session needs to be used between different
93// endpoints, as is required by some protocols, such as FTP over TLS.
94// @source should have already completed a handshake and, since TLS 1.3,
95// it should have been used to read data at least once. @conn should not
96// have completed a handshake.
97//
98// It is not possible to know whether a call to this function will
99// actually do anything. Because session resumption is normally used
100// only for performance benefit, the TLS backend might not implement
101// this function. Even if implemented, it may not actually succeed in
102// allowing @conn to resume @source's TLS session, because the server
103// may not have sent a session resumption token to @source, or it may
104// refuse to accept the token from @conn. There is no way to know
105// whether a call to this function is actually successful.
106//
107// Using this function is not required to benefit from session
108// resumption. If the TLS backend supports session resumption, the
109// session will be resumed automatically if it is possible to do so
110// without weakening the privacy guarantees normally provided by TLS,
111// without need to call this function. For example, with TLS 1.3,
112// a session ticket will be automatically copied from any
113// #GTlsClientConnection that has previously received session tickets
114// from the server, provided a ticket is available that has not
115// previously been used for session resumption, since session ticket
116// reuse would be a privacy weakness. Using this function causes the
117// ticket to be copied without regard for privacy considerations.
118func (x *TlsClientConnectionBase) CopySessionState(SourceVar TlsClientConnection) {
119
120	XGTlsClientConnectionCopySessionState(x.GoPointer(), SourceVar.GoPointer())
121
122}
123
124// Gets the list of distinguished names of the Certificate Authorities
125// that the server will accept certificates from. This will be set
126// during the TLS handshake if the server requests a certificate.
127// Otherwise, it will be %NULL.
128//
129// Each item in the list is a #GByteArray which contains the complete
130// subject DN of the certificate authority.
131func (x *TlsClientConnectionBase) GetAcceptedCas() *glib.List {
132
133	cret := XGTlsClientConnectionGetAcceptedCas(x.GoPointer())
134	return cret
135}
136
137// Gets @conn's expected server identity
138func (x *TlsClientConnectionBase) GetServerIdentity() *SocketConnectableBase {
139	var cls *SocketConnectableBase
140
141	cret := XGTlsClientConnectionGetServerIdentity(x.GoPointer())
142
143	if cret == 0 {
144		return nil
145	}
146	gobject.IncreaseRef(cret)
147	cls = &SocketConnectableBase{}
148	cls.Ptr = cret
149	return cls
150}
151
152// SSL 3.0 is no longer supported. See
153// g_tls_client_connection_set_use_ssl3() for details.
154func (x *TlsClientConnectionBase) GetUseSsl3() bool {
155
156	cret := XGTlsClientConnectionGetUseSsl3(x.GoPointer())
157	return cret
158}
159
160// Gets @conn's validation flags
161//
162// This function does not work as originally designed and is impossible
163// to use correctly. See #GTlsClientConnection:validation-flags for more
164// information.
165func (x *TlsClientConnectionBase) GetValidationFlags() TlsCertificateFlags {
166
167	cret := XGTlsClientConnectionGetValidationFlags(x.GoPointer())
168	return cret
169}
170
171// Sets @conn's expected server identity, which is used both to tell
172// servers on virtual hosts which certificate to present, and also
173// to let @conn know what name to look for in the certificate when
174// performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
175func (x *TlsClientConnectionBase) SetServerIdentity(IdentityVar SocketConnectable) {
176
177	XGTlsClientConnectionSetServerIdentity(x.GoPointer(), IdentityVar.GoPointer())
178
179}
180
181// Since GLib 2.42.1, SSL 3.0 is no longer supported.
182//
183// From GLib 2.42.1 through GLib 2.62, this function could be used to
184// force use of TLS 1.0, the lowest-supported TLS protocol version at
185// the time. In the past, this was needed to connect to broken TLS
186// servers that exhibited protocol version intolerance. Such servers
187// are no longer common, and using TLS 1.0 is no longer considered
188// acceptable.
189//
190// Since GLib 2.64, this function does nothing.
191func (x *TlsClientConnectionBase) SetUseSsl3(UseSsl3Var bool) {
192
193	XGTlsClientConnectionSetUseSsl3(x.GoPointer(), UseSsl3Var)
194
195}
196
197// Sets @conn's validation flags, to override the default set of
198// checks performed when validating a server certificate. By default,
199// %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
200//
201// This function does not work as originally designed and is impossible
202// to use correctly. See #GTlsClientConnection:validation-flags for more
203// information.
204func (x *TlsClientConnectionBase) SetValidationFlags(FlagsVar TlsCertificateFlags) {
205
206	XGTlsClientConnectionSetValidationFlags(x.GoPointer(), FlagsVar)
207
208}
209
210// SetPropertyUseSsl3 sets the "use-ssl3" property.
211// SSL 3.0 is no longer supported. See
212// g_tls_client_connection_set_use_ssl3() for details.
213func (x *TlsClientConnectionBase) SetPropertyUseSsl3(value bool) {
214	obj := gobject.Object{}
215	obj.Ptr = x.GoPointer()
216	var v gobject.Value
217	v.Init(gobject.TypeBooleanVal)
218	v.SetBoolean(value)
219	obj.SetProperty("use-ssl3", &v)
220}
221
222// GetPropertyUseSsl3 gets the "use-ssl3" property.
223// SSL 3.0 is no longer supported. See
224// g_tls_client_connection_set_use_ssl3() for details.
225func (x *TlsClientConnectionBase) GetPropertyUseSsl3() bool {
226	obj := gobject.Object{}
227	obj.Ptr = x.GoPointer()
228	var v gobject.Value
229	obj.GetProperty("use-ssl3", &v)
230	return v.GetBoolean()
231}
232
233var XGTlsClientConnectionCopySessionState func(uintptr, uintptr)
234var XGTlsClientConnectionGetAcceptedCas func(uintptr) *glib.List
235var XGTlsClientConnectionGetServerIdentity func(uintptr) uintptr
236var XGTlsClientConnectionGetUseSsl3 func(uintptr) bool
237var XGTlsClientConnectionGetValidationFlags func(uintptr) TlsCertificateFlags
238var XGTlsClientConnectionSetServerIdentity func(uintptr, uintptr)
239var XGTlsClientConnectionSetUseSsl3 func(uintptr, bool)
240var XGTlsClientConnectionSetValidationFlags func(uintptr, TlsCertificateFlags)
241
242var xTlsClientConnectionNew func(uintptr, uintptr, **glib.Error) uintptr
243
244// Creates a new #GTlsClientConnection wrapping @base_io_stream (which
245// must have pollable input and output streams) which is assumed to
246// communicate with the server identified by @server_identity.
247//
248// See the documentation for #GTlsConnection:base-io-stream for restrictions
249// on when application code can run operations on the @base_io_stream after
250// this function has returned.
251func TlsClientConnectionNew(BaseIoStreamVar *IOStream, ServerIdentityVar SocketConnectable) (*TlsClientConnectionBase, error) {
252	var cls *TlsClientConnectionBase
253	var cerr *glib.Error
254
255	cret := xTlsClientConnectionNew(BaseIoStreamVar.GoPointer(), ServerIdentityVar.GoPointer(), &cerr)
256
257	if cret == 0 {
258		return nil, cerr
259	}
260	cls = &TlsClientConnectionBase{}
261	cls.Ptr = cret
262	if cerr == nil {
263		return cls, nil
264	}
265	return cls, cerr
266
267}
268
269func init() {
270	core.SetPackageName("GIO", "gio-2.0")
271	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
272	var libs []uintptr
273	for _, libPath := range core.GetPaths("GIO") {
274		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
275		if err != nil {
276			panic(err)
277		}
278		libs = append(libs, lib)
279	}
280
281	core.PuregoSafeRegister(&xTlsClientConnectionNew, libs, "g_tls_client_connection_new")
282
283	core.PuregoSafeRegister(&xTlsClientConnectionGLibType, libs, "g_tls_client_connection_get_type")
284
285	core.PuregoSafeRegister(&XGTlsClientConnectionCopySessionState, libs, "g_tls_client_connection_copy_session_state")
286	core.PuregoSafeRegister(&XGTlsClientConnectionGetAcceptedCas, libs, "g_tls_client_connection_get_accepted_cas")
287	core.PuregoSafeRegister(&XGTlsClientConnectionGetServerIdentity, libs, "g_tls_client_connection_get_server_identity")
288	core.PuregoSafeRegister(&XGTlsClientConnectionGetUseSsl3, libs, "g_tls_client_connection_get_use_ssl3")
289	core.PuregoSafeRegister(&XGTlsClientConnectionGetValidationFlags, libs, "g_tls_client_connection_get_validation_flags")
290	core.PuregoSafeRegister(&XGTlsClientConnectionSetServerIdentity, libs, "g_tls_client_connection_set_server_identity")
291	core.PuregoSafeRegister(&XGTlsClientConnectionSetUseSsl3, libs, "g_tls_client_connection_set_use_ssl3")
292	core.PuregoSafeRegister(&XGTlsClientConnectionSetValidationFlags, libs, "g_tls_client_connection_set_validation_flags")
293
294}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close