Gio.SimpleProxyResolver - Classes - Gio 2.0 (original) (raw)

g GObject.GInterface GObject.GInterface Gio.ProxyResolver Gio.ProxyResolver GObject.GInterface->Gio.ProxyResolver GObject.Object GObject.Object Gio.SimpleProxyResolver Gio.SimpleProxyResolver GObject.Object->Gio.SimpleProxyResolver Gio.ProxyResolver->Gio.SimpleProxyResolver

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.ProxyResolver (5)

Structs:

GObject.ObjectClass (5)

class new (default_proxy, ignore_hosts)
set_default_proxy (default_proxy)
set_ignore_hosts (ignore_hosts)
set_uri_proxy (uri_scheme, proxy)

Virtual Methods

Inherited:

GObject.Object (7), Gio.ProxyResolver (4)

Properties

Name Type Flags Short Description
default-proxy str r/w
ignore-hosts [str] r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name Type Access Description
parent_instance GObject.Object r

Class Details

class Gio.SimpleProxyResolver(**kwargs)

Bases:

GObject.Object, Gio.ProxyResolver

Abstract:

No

Structure:

Gio.SimpleProxyResolverClass

GSimpleProxyResolver is a simple [iface`Gio`.ProxyResolver] implementation that handles a single default proxy, multiple URI-scheme-specific proxies, and a list of hosts that proxies should not be used for.

GSimpleProxyResolver is never the default proxy resolver, but it can be used as the base class for another proxy resolver implementation, or it can be created and used manually, such as with [method`Gio`.SocketClient.set_proxy_resolver].

New in version 2.36.

classmethod new(default_proxy, ignore_hosts)[source]

Parameters:

Returns:

a new Gio.SimpleProxyResolver

Return type:

Gio.ProxyResolver

Creates a new Gio.SimpleProxyResolver. SeeGio.SimpleProxyResolver :default-proxy andGio.SimpleProxyResolver :ignore-hosts for more details on how the arguments are interpreted.

New in version 2.36.

set_default_proxy(default_proxy)[source]

Parameters:

default_proxy (str or None) – the default proxy to use

Sets the default proxy on self, to be used for any URIs that don’t match Gio.SimpleProxyResolver :ignore-hosts or a proxy set via Gio.SimpleProxyResolver.set_uri_proxy().

If default_proxy starts with “socks://”,Gio.SimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

New in version 2.36.

set_ignore_hosts(ignore_hosts)[source]

Parameters:

ignore_hosts ([str]) – None-terminated list of hosts/IP addresses to not use a proxy for

Sets the list of ignored hosts.

See Gio.SimpleProxyResolver :ignore-hosts for more details on how theignore_hosts argument is interpreted.

New in version 2.36.

set_uri_proxy(uri_scheme, proxy)[source]

Parameters:

Adds a URI-scheme-specific proxy to self; URIs whose scheme matches uri_scheme (and which don’t matchGio.SimpleProxyResolver :ignore-hosts) will be proxied via proxy.

As with Gio.SimpleProxyResolver :default-proxy, if proxy starts with “socks://”, Gio.SimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

New in version 2.36.

Property Details

Gio.SimpleProxyResolver.props.default_proxy

Name:

default-proxy

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The default proxy URI that will be used for any URI that doesn’t match Gio.SimpleProxyResolver :ignore-hosts, and doesn’t match any of the schemes set with Gio.SimpleProxyResolver.set_uri_proxy().

Note that as a special case, if this URI starts with “socks://”, Gio.SimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

Gio.SimpleProxyResolver.props.ignore_hosts

Name:

ignore-hosts

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

A list of hostnames and IP addresses that the resolver should allow direct connections to.

Entries can be in one of 4 formats:

Note that when dealing with Unicode hostnames, the matching is done against the ASCII form of the name.

Also note that hostname exclusions apply only to connections made to hosts identified by name, and IP address exclusions apply only to connections made to hosts identified by address. That is, if example.com has an address of 192.168.1.1, and the :ignore-hosts list contains only “192.168.1.1”, then a connection to “example.com” (eg, via a Gio.NetworkAddress) will use the proxy, and a connection to “192.168.1.1” (eg, via a Gio.InetSocketAddress) will not.

These rules match the “ignore-hosts”/”noproxy” rules most commonly used by other applications.