gi-gio-2.0.32: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Interfaces.Proxy

Contents

- Exported types
- Methods
  - connect
  - connectAsync
  - connectFinish
  - getDefaultForProtocol
  - supportsHostname

Description

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 `iOExtensionPointGetExtensionByName`.

Since: 2.26

Synopsis

- newtype Proxy = Proxy (ManagedPtr Proxy)
- class (GObject o, IsDescendantOf Proxy o) => IsProxy o
- toProxy :: (MonadIO m, IsProxy o) => o -> m Proxy
- proxyConnect :: (HasCallStack, MonadIO m, IsProxy a, IsIOStream b, IsProxyAddress c, IsCancellable d) => a -> b -> c -> Maybe d -> m IOStream
- proxyConnectAsync :: (HasCallStack, MonadIO m, IsProxy a, IsIOStream b, IsProxyAddress c, IsCancellable d) => a -> b -> c -> Maybe d -> Maybe AsyncReadyCallback -> m ()
- proxyConnectFinish :: (HasCallStack, MonadIO m, IsProxy a, IsAsyncResult b) => a -> b -> m IOStream
- proxyGetDefaultForProtocol :: (HasCallStack, MonadIO m) => Text -> m (Maybe Proxy)
- proxySupportsHostname :: (HasCallStack, MonadIO m, IsProxy a) => a -> m Bool

# Exported types

newtype Proxy Source #

Memory-managed wrapper type.

Constructors

Proxy (ManagedPtr Proxy) |

#### Instances

Instances details

Eq Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy Methods (==) :: Proxy -> Proxy -> Bool Source # (/=) :: Proxy -> Proxy -> Bool Source #
GObject Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy
ManagedPtrNewtype Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy Methods toManagedPtr :: Proxy -> ManagedPtr Proxy Source #
TypedObject Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy Methods glibType :: IO GType Source #
HasParentTypes Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy
IsGValue (Maybe Proxy) Source # | Convert `Proxy` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Interfaces.Proxy Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Proxy -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Proxy) Source #
type ParentTypes Proxy Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy type ParentTypes Proxy = '[Object]

class (GObject o, IsDescendantOf Proxy o) => IsProxy o Source #

Type class for types which can be safely cast to `Proxy`, for instance with `toProxy`.

#### Instances

Instances details

(GObject o, IsDescendantOf Proxy o) => IsProxy o Source # |
Instance details Defined in GI.Gio.Interfaces.Proxy

toProxy :: (MonadIO m, IsProxy o) => o -> m Proxy Source #

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

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, connect, connectAsync, connectFinish, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, supportsHostname, thawNotify, unref, watchClosure.

#### Getters

getData, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## connect

proxyConnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsProxy a, IsIOStream b, IsProxyAddress c, IsCancellable d) |
=> a | `proxy`: a `Proxy`
-> b | `connection`: a `IOStream`
-> c | `proxyAddress`: a `ProxyAddress`
-> Maybe d | `cancellable`: a `Cancellable`
-> m IOStream | Returns: a `IOStream` that will replace `connection`. This might be the same as `connection`, in which case a reference will be added. (Can throw `GError`)

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

Since: 2.26

## connectAsync

proxyConnectAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsProxy a, IsIOStream b, IsProxyAddress c, IsCancellable d) |
=> a | `proxy`: a `Proxy`
-> b | `connection`: a `IOStream`
-> c | `proxyAddress`: a `ProxyAddress`
-> Maybe d | `cancellable`: a `Cancellable`
-> Maybe AsyncReadyCallback | `callback`: a `AsyncReadyCallback`
-> m () |

Asynchronous version of `proxyConnect`.

Since: 2.26

## connectFinish

proxyConnectFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsProxy a, IsAsyncResult b) |
=> a | `proxy`: a `Proxy`
-> b | `result`: a `AsyncResult`
-> m IOStream | Returns: a `IOStream`. (Can throw `GError`)

See `proxyConnect`.

Since: 2.26

## getDefaultForProtocol

proxyGetDefaultForProtocol Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `protocol`: the proxy protocol name (e.g. http, socks, etc)
-> m (Maybe Proxy) | Returns: return a `Proxy` or NULL if protocol is not supported.

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

Since: 2.26

## supportsHostname

proxySupportsHostname Source #

Arguments

:: (HasCallStack, MonadIO m, IsProxy a) |
=> a | `proxy`: a `Proxy`
-> m Bool | Returns: `True` if hostname resolution is supported.

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 `ProxyAddress` containing the stringified IP address to `proxyConnect` or `proxyConnectAsync`.

Since: 2.26