Gio.Proxy

g GObject.GInterface GObject.GInterface Gio.Proxy Gio.Proxy GObject.GInterface->Gio.Proxy

Implementations:

None

Methods

class

get_default_for_protocol (protocol)

connect (connection, proxy_address, cancellable)

connect_async (connection, proxy_address, cancellable, callback, *user_data)

connect_finish (result)

supports_hostname ()

Virtual Methods

do_connect (connection, proxy_address, cancellable)

do_connect_async (connection, proxy_address, cancellable, callback, *user_data)

do_connect_finish (result)

do_supports_hostname ()

Properties

None

Signals

None

Fields

None

Class Details

class Gio.Proxy
Bases:

GObject.GInterface

Structure:

Gio.ProxyInterface

A GProxy handles connecting to a remote host via a given type of proxy server. It is implemented by the gio-proxy extension point. The extensions are named after their proxy protocol name. As an example, a SOCKS5 proxy implementation can be retrieved with the name socks5 using the function [method`Gio`.IOExtensionPoint.get_extension_by_name].

New in version 2.26.

classmethod get_default_for_protocol(protocol)[source]
Parameters:

protocol (str) – the proxy protocol name (e.g. http, socks, etc)

Returns:

return a Gio.Proxy or None if protocol is not supported.

Return type:

Gio.Proxy or None

Find the gio-proxy extension point for a proxy implementation that supports the specified protocol.

New in version 2.26.

connect(connection, proxy_address, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

a Gio.IOStream that will replace connection. This might be the same as connection, in which case a reference will be added.

Return type:

Gio.IOStream

Given connection to communicate with a proxy (eg, a Gio.SocketConnection that is connected to the proxy server), this does the necessary handshake to connect to proxy_address, and if required, wraps the Gio.IOStream to handle proxy payload.

New in version 2.26.

connect_async(connection, proxy_address, cancellable, callback, *user_data)[source]
Parameters:

Asynchronous version of Gio.Proxy.connect().

New in version 2.26.

connect_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a Gio.IOStream.

Return type:

Gio.IOStream

See Gio.Proxy.connect().

New in version 2.26.

supports_hostname()[source]
Returns:

True if hostname resolution is supported.

Return type:

bool

Some proxy protocols expect to be passed a hostname, which they will resolve to an IP address themselves. Others, like SOCKS4, do not allow this. This function will return False if self is implementing such a protocol. When False is returned, the caller should resolve the destination hostname first, and then pass a Gio.ProxyAddress containing the stringified IP address to Gio.Proxy.connect() or Gio.Proxy.connect_async().

New in version 2.26.

do_connect(connection, proxy_address, cancellable) virtual
Parameters:
Returns:

a Gio.IOStream that will replace connection. This might be the same as connection, in which case a reference will be added.

Return type:

Gio.IOStream

Given connection to communicate with a proxy (eg, a Gio.SocketConnection that is connected to the proxy server), this does the necessary handshake to connect to proxy_address, and if required, wraps the Gio.IOStream to handle proxy payload.

New in version 2.26.

do_connect_async(connection, proxy_address, cancellable, callback, *user_data) virtual
Parameters:

Asynchronous version of Gio.Proxy.connect().

New in version 2.26.

do_connect_finish(result) virtual
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Returns:

a Gio.IOStream.

Return type:

Gio.IOStream

See Gio.Proxy.connect().

New in version 2.26.

do_supports_hostname() virtual
Returns:

True if hostname resolution is supported.

Return type:

bool

Some proxy protocols expect to be passed a hostname, which they will resolve to an IP address themselves. Others, like SOCKS4, do not allow this. This function will return False if proxy is implementing such a protocol. When False is returned, the caller should resolve the destination hostname first, and then pass a Gio.ProxyAddress containing the stringified IP address to Gio.Proxy.connect() or Gio.Proxy.connect_async().

New in version 2.26.