gi-gio-2.0.19: Gio bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com)
Safe Haskell | None
Language | Haskell2010

GI.Gio.Objects.SimpleProxyResolver

Contents

- Exported types
- Methods
  - new
  - setDefaultProxy
  - setIgnoreHosts
  - setUriProxy
- Properties
  - defaultProxy
  - ignoreHosts

Description

`SimpleProxyResolver` is a simple `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.

`SimpleProxyResolver` 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 `socketClientSetProxyResolver`.

Since: 2.36

Synopsis

- newtype SimpleProxyResolver = SimpleProxyResolver (ManagedPtr SimpleProxyResolver)
- class GObject o => IsSimpleProxyResolver o
- toSimpleProxyResolver :: (MonadIO m, IsSimpleProxyResolver o) => o -> m SimpleProxyResolver
- noSimpleProxyResolver :: Maybe SimpleProxyResolver
- simpleProxyResolverNew :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> m ProxyResolver
- simpleProxyResolverSetDefaultProxy :: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) => a -> Text -> m ()
- simpleProxyResolverSetIgnoreHosts :: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) => a -> Text -> m ()
- simpleProxyResolverSetUriProxy :: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) => a -> Text -> Text -> m ()
- constructSimpleProxyResolverDefaultProxy :: IsSimpleProxyResolver o => Text -> IO (GValueConstruct o)
- getSimpleProxyResolverDefaultProxy :: (MonadIO m, IsSimpleProxyResolver o) => o -> m (Maybe Text)
- setSimpleProxyResolverDefaultProxy :: (MonadIO m, IsSimpleProxyResolver o) => o -> Text -> m ()
- clearSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> m ()
- constructSimpleProxyResolverIgnoreHosts :: IsSimpleProxyResolver o => [Text] -> IO (GValueConstruct o)
- getSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> m (Maybe [Text])
- setSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> [Text] -> m ()

# Exported types

newtype SimpleProxyResolver Source #

Memory-managed wrapper type.

Constructors

SimpleProxyResolver (ManagedPtr SimpleProxyResolver) |

Instances

GObject SimpleProxyResolver Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver Methods gobjectType :: SimpleProxyResolver -> IO GType Source #
IsObject SimpleProxyResolver Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver
IsProxyResolver SimpleProxyResolver Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver
IsSimpleProxyResolver SimpleProxyResolver Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver

class GObject o => IsSimpleProxyResolver o Source #

Type class for types which can be safely cast to `SimpleProxyResolver`, for instance with `toSimpleProxyResolver`.

Instances

(GObject a, (UnknownAncestorError SimpleProxyResolver a :: Constraint)) => IsSimpleProxyResolver a Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver
IsSimpleProxyResolver SimpleProxyResolver Source # |
Instance details Defined in GI.Gio.Objects.SimpleProxyResolver

toSimpleProxyResolver :: (MonadIO m, IsSimpleProxyResolver o) => o -> m SimpleProxyResolver Source #

Cast to `SimpleProxyResolver`, for types for which this is known to be safe. For general casts, use `castTo`.

noSimpleProxyResolver :: Maybe SimpleProxyResolver Source #

A convenience alias for `Nothing` :: `Maybe` `SimpleProxyResolver`.

# Methods

## new

simpleProxyResolverNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `defaultProxy`: the default proxy to use, eg "socks://192.168.1.1"
-> Maybe Text | `ignoreHosts`: an optional list of hosts/IP addresses to not use a proxy for.
-> m ProxyResolver | Returns: a new `SimpleProxyResolver`

Creates a new `SimpleProxyResolver`. See `SimpleProxyResolver`:`default-proxy` and `SimpleProxyResolver`:`ignore-hosts` for more details on how the arguments are interpreted.

Since: 2.36

## setDefaultProxy

simpleProxyResolverSetDefaultProxy Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) |
=> a | `resolver`: a `SimpleProxyResolver`
-> Text | `defaultProxy`: the default proxy to use
-> m () |

Sets the default proxy on `resolver`, to be used for any URIs that don't match `SimpleProxyResolver`:`ignore-hosts` or a proxy set via `simpleProxyResolverSetUriProxy`.

If `defaultProxy` starts with "socks://", `SimpleProxyResolver` will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

Since: 2.36

## setIgnoreHosts

simpleProxyResolverSetIgnoreHosts Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) |
=> a | `resolver`: a `SimpleProxyResolver`
-> Text | `ignoreHosts`: `Nothing`-terminated list of hosts/IP addresses to not use a proxy for
-> m () |

Sets the list of ignored hosts.

See `SimpleProxyResolver`:`ignore-hosts` for more details on how the `ignoreHosts` argument is interpreted.

Since: 2.36

## setUriProxy

simpleProxyResolverSetUriProxy Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleProxyResolver a) |
=> a | `resolver`: a `SimpleProxyResolver`
-> Text | `uriScheme`: the URI scheme to add a proxy for
-> Text | `proxy`: the proxy to use for `uriScheme`
-> m () |

Adds a URI-scheme-specific proxy to `resolver`; URIs whose scheme matches `uriScheme` (and which don't match `SimpleProxyResolver`:`ignore-hosts`) will be proxied via `proxy`.

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

Since: 2.36

# Properties

## defaultProxy

The default proxy URI that will be used for any URI that doesn't match `SimpleProxyResolver`:`ignore-hosts`, and doesn't match any of the schemes set with `simpleProxyResolverSetUriProxy`.

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

constructSimpleProxyResolverDefaultProxy :: IsSimpleProxyResolver o => Text -> IO (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`default-proxy`” property. This is rarely needed directly, but it is used by `new`.

getSimpleProxyResolverDefaultProxy :: (MonadIO m, IsSimpleProxyResolver o) => o -> m (Maybe Text) Source #

Get the value of the “`default-proxy`” property. When overloading is enabled, this is equivalent to

    get simpleProxyResolver #defaultProxy

setSimpleProxyResolverDefaultProxy :: (MonadIO m, IsSimpleProxyResolver o) => o -> Text -> m () Source #

Set the value of the “`default-proxy`” property. When overloading is enabled, this is equivalent to

    set simpleProxyResolver [ #defaultProxy := value ]

## ignoreHosts

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

Entries can be in one of 4 formats:

- A hostname, such as "example.com", ".example.com", or "*.example.com", any of which match "example.com" or any subdomain of it.
- An IPv4 or IPv6 address, such as "192.168.1.1", which matches only that address.
- A hostname or IP address followed by a port, such as "example.com:80", which matches whatever the hostname or IP address would match, but only for URLs with the (explicitly) indicated port. In the case of an IPv6 address, the address part must appear in brackets: "[::1]:443"
- An IP address range, given by a base address and prefix length, such as "fe80::/10", which matches any address in that range.

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 `NetworkAddress`) will use the proxy, and a connection to "192.168.1.1" (eg, via a `InetSocketAddress`) will not.

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

clearSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> m () Source #

Set the value of the “`ignore-hosts`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #ignoreHosts

constructSimpleProxyResolverIgnoreHosts :: IsSimpleProxyResolver o => [Text] -> IO (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`ignore-hosts`” property. This is rarely needed directly, but it is used by `new`.

getSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> m (Maybe [Text]) Source #

Get the value of the “`ignore-hosts`” property. When overloading is enabled, this is equivalent to

    get simpleProxyResolver #ignoreHosts

setSimpleProxyResolverIgnoreHosts :: (MonadIO m, IsSimpleProxyResolver o) => o -> [Text] -> m () Source #

Set the value of the “`ignore-hosts`” property. When overloading is enabled, this is equivalent to

    set simpleProxyResolver [ #ignoreHosts := value ]