v0.2.1 c0399be

gnetworkaddress.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
16type NetworkAddressClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *NetworkAddressClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26type NetworkAddressPrivate struct {
27	_ structs.HostLayout
28}
29
30func (x *NetworkAddressPrivate) GoPointer() uintptr {
31	return uintptr(unsafe.Pointer(x))
32}
33
34// `GNetworkAddress` provides an easy way to resolve a hostname and
35// then attempt to connect to that host, handling the possibility of
36// multiple IP addresses and multiple address families.
37//
38// The enumeration results of resolved addresses *may* be cached as long
39// as this object is kept alive which may have unexpected results if
40// alive for too long.
41//
42// See [iface@Gio.SocketConnectable] for an example of using the connectable
43// interface.
44type NetworkAddress struct {
45	gobject.Object
46}
47
48var xNetworkAddressGLibType func() types.GType
49
50func NetworkAddressGLibType() types.GType {
51	return xNetworkAddressGLibType()
52}
53
54func NetworkAddressNewFromInternalPtr(ptr uintptr) *NetworkAddress {
55	cls := &NetworkAddress{}
56	cls.Ptr = ptr
57	return cls
58}
59
60var xNewNetworkAddress func(string, uint16) uintptr
61
62// Creates a new #GSocketConnectable for connecting to the given
63// @hostname and @port.
64//
65// Note that depending on the configuration of the machine, a
66// @hostname of `localhost` may refer to the IPv4 loopback address
67// only, or to both IPv4 and IPv6; use
68// g_network_address_new_loopback() to create a #GNetworkAddress that
69// is guaranteed to resolve to both addresses.
70func NewNetworkAddress(HostnameVar string, PortVar uint16) *NetworkAddress {
71	var cls *NetworkAddress
72
73	cret := xNewNetworkAddress(HostnameVar, PortVar)
74
75	if cret == 0 {
76		return nil
77	}
78	cls = &NetworkAddress{}
79	cls.Ptr = cret
80	return cls
81}
82
83var xNewNetworkAddressLoopback func(uint16) uintptr
84
85// Creates a new #GSocketConnectable for connecting to the local host
86// over a loopback connection to the given @port. This is intended for
87// use in connecting to local services which may be running on IPv4 or
88// IPv6.
89//
90// The connectable will return IPv4 and IPv6 loopback addresses,
91// regardless of how the host resolves `localhost`. By contrast,
92// g_network_address_new() will often only return an IPv4 address when
93// resolving `localhost`, and an IPv6 address for `localhost6`.
94//
95// g_network_address_get_hostname() will always return `localhost` for
96// a #GNetworkAddress created with this constructor.
97func NewNetworkAddressLoopback(PortVar uint16) *NetworkAddress {
98	var cls *NetworkAddress
99
100	cret := xNewNetworkAddressLoopback(PortVar)
101
102	if cret == 0 {
103		return nil
104	}
105	cls = &NetworkAddress{}
106	cls.Ptr = cret
107	return cls
108}
109
110var xNetworkAddressGetHostname func(uintptr) string
111
112// Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded,
113// depending on what @addr was created with.
114func (x *NetworkAddress) GetHostname() string {
115
116	cret := xNetworkAddressGetHostname(x.GoPointer())
117	return cret
118}
119
120var xNetworkAddressGetPort func(uintptr) uint16
121
122// Gets @addr's port number
123func (x *NetworkAddress) GetPort() uint16 {
124
125	cret := xNetworkAddressGetPort(x.GoPointer())
126	return cret
127}
128
129var xNetworkAddressGetScheme func(uintptr) string
130
131// Gets @addr's scheme
132func (x *NetworkAddress) GetScheme() string {
133
134	cret := xNetworkAddressGetScheme(x.GoPointer())
135	return cret
136}
137
138func (c *NetworkAddress) GoPointer() uintptr {
139	if c == nil {
140		return 0
141	}
142	return c.Ptr
143}
144
145func (c *NetworkAddress) SetGoPointer(ptr uintptr) {
146	c.Ptr = ptr
147}
148
149// SetPropertyHostname sets the "hostname" property.
150// Hostname to resolve.
151func (x *NetworkAddress) SetPropertyHostname(value string) {
152	var v gobject.Value
153	v.Init(gobject.TypeStringVal)
154	v.SetString(&value)
155	x.SetProperty("hostname", &v)
156}
157
158// GetPropertyHostname gets the "hostname" property.
159// Hostname to resolve.
160func (x *NetworkAddress) GetPropertyHostname() string {
161	var v gobject.Value
162	x.GetProperty("hostname", &v)
163	return v.GetString()
164}
165
166// SetPropertyPort sets the "port" property.
167// Network port.
168func (x *NetworkAddress) SetPropertyPort(value uint) {
169	var v gobject.Value
170	v.Init(gobject.TypeUintVal)
171	v.SetUint(value)
172	x.SetProperty("port", &v)
173}
174
175// GetPropertyPort gets the "port" property.
176// Network port.
177func (x *NetworkAddress) GetPropertyPort() uint {
178	var v gobject.Value
179	x.GetProperty("port", &v)
180	return v.GetUint()
181}
182
183// SetPropertyScheme sets the "scheme" property.
184// URI scheme.
185func (x *NetworkAddress) SetPropertyScheme(value string) {
186	var v gobject.Value
187	v.Init(gobject.TypeStringVal)
188	v.SetString(&value)
189	x.SetProperty("scheme", &v)
190}
191
192// GetPropertyScheme gets the "scheme" property.
193// URI scheme.
194func (x *NetworkAddress) GetPropertyScheme() string {
195	var v gobject.Value
196	x.GetProperty("scheme", &v)
197	return v.GetString()
198}
199
200// Creates a #GSocketAddressEnumerator for @connectable.
201func (x *NetworkAddress) Enumerate() *SocketAddressEnumerator {
202	var cls *SocketAddressEnumerator
203
204	cret := XGSocketConnectableEnumerate(x.GoPointer())
205
206	if cret == 0 {
207		return nil
208	}
209	cls = &SocketAddressEnumerator{}
210	cls.Ptr = cret
211	return cls
212}
213
214// Creates a #GSocketAddressEnumerator for @connectable that will
215// return a #GProxyAddress for each of its addresses that you must connect
216// to via a proxy.
217//
218// If @connectable does not implement
219// g_socket_connectable_proxy_enumerate(), this will fall back to
220// calling g_socket_connectable_enumerate().
221func (x *NetworkAddress) ProxyEnumerate() *SocketAddressEnumerator {
222	var cls *SocketAddressEnumerator
223
224	cret := XGSocketConnectableProxyEnumerate(x.GoPointer())
225
226	if cret == 0 {
227		return nil
228	}
229	cls = &SocketAddressEnumerator{}
230	cls.Ptr = cret
231	return cls
232}
233
234// Format a #GSocketConnectable as a string. This is a human-readable format for
235// use in debugging output, and is not a stable serialization format. It is not
236// suitable for use in user interfaces as it exposes too much information for a
237// user.
238//
239// If the #GSocketConnectable implementation does not support string formatting,
240// the implementation’s type name will be returned as a fallback.
241func (x *NetworkAddress) ToString() string {
242
243	cret := XGSocketConnectableToString(x.GoPointer())
244	return cret
245}
246
247var xNetworkAddressParse func(string, uint16, **glib.Error) uintptr
248
249// Creates a new #GSocketConnectable for connecting to the given
250// @hostname and @port. May fail and return %NULL in case
251// parsing @host_and_port fails.
252//
253// @host_and_port may be in any of a number of recognised formats; an IPv6
254// address, an IPv4 address, or a domain name (in which case a DNS
255// lookup is performed). Quoting with [] is supported for all address
256// types. A port override may be specified in the usual way with a
257// colon.
258//
259// If no port is specified in @host_and_port then @default_port will be
260// used as the port number to connect to.
261//
262// In general, @host_and_port is expected to be provided by the user
263// (allowing them to give the hostname, and a port override if necessary)
264// and @default_port is expected to be provided by the application.
265//
266// (The port component of @host_and_port can also be specified as a
267// service name rather than as a numeric port, but this functionality
268// is deprecated, because it depends on the contents of /etc/services,
269// which is generally quite sparse on platforms other than Linux.)
270func NetworkAddressParse(HostAndPortVar string, DefaultPortVar uint16) (*NetworkAddress, error) {
271	var cls *NetworkAddress
272	var cerr *glib.Error
273
274	cret := xNetworkAddressParse(HostAndPortVar, DefaultPortVar, &cerr)
275
276	if cret == 0 {
277		return nil, cerr
278	}
279	cls = &NetworkAddress{}
280	cls.Ptr = cret
281	if cerr == nil {
282		return cls, nil
283	}
284	return cls, cerr
285
286}
287
288var xNetworkAddressParseUri func(string, uint16, **glib.Error) uintptr
289
290// Creates a new #GSocketConnectable for connecting to the given
291// @uri. May fail and return %NULL in case parsing @uri fails.
292//
293// Using this rather than g_network_address_new() or
294// g_network_address_parse() allows #GSocketClient to determine
295// when to use application-specific proxy protocols.
296func NetworkAddressParseUri(UriVar string, DefaultPortVar uint16) (*NetworkAddress, error) {
297	var cls *NetworkAddress
298	var cerr *glib.Error
299
300	cret := xNetworkAddressParseUri(UriVar, DefaultPortVar, &cerr)
301
302	if cret == 0 {
303		return nil, cerr
304	}
305	cls = &NetworkAddress{}
306	cls.Ptr = cret
307	if cerr == nil {
308		return cls, nil
309	}
310	return cls, cerr
311
312}
313
314func init() {
315	core.SetPackageName("GIO", "gio-2.0")
316	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
317	var libs []uintptr
318	for _, libPath := range core.GetPaths("GIO") {
319		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
320		if err != nil {
321			panic(err)
322		}
323		libs = append(libs, lib)
324	}
325
326	core.PuregoSafeRegister(&xNetworkAddressGLibType, libs, "g_network_address_get_type")
327
328	core.PuregoSafeRegister(&xNewNetworkAddress, libs, "g_network_address_new")
329	core.PuregoSafeRegister(&xNewNetworkAddressLoopback, libs, "g_network_address_new_loopback")
330
331	core.PuregoSafeRegister(&xNetworkAddressGetHostname, libs, "g_network_address_get_hostname")
332	core.PuregoSafeRegister(&xNetworkAddressGetPort, libs, "g_network_address_get_port")
333	core.PuregoSafeRegister(&xNetworkAddressGetScheme, libs, "g_network_address_get_scheme")
334
335	core.PuregoSafeRegister(&xNetworkAddressParse, libs, "g_network_address_parse")
336	core.PuregoSafeRegister(&xNetworkAddressParseUri, libs, "g_network_address_parse_uri")
337
338}

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