gi-gio-2.0.18: Gio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Interfaces.Proxy

Contents

Description

A Proxy 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

Exported types

newtype Proxy Source #

Memory-managed wrapper type.

Constructors

Proxy (ManagedPtr Proxy) 
Instances
GObject Proxy Source # 
Instance details

Defined in GI.Gio.Interfaces.Proxy

Methods

gobjectType :: Proxy -> IO GType #

IsObject Proxy Source # 
Instance details

Defined in GI.Gio.Interfaces.Proxy

IsProxy Proxy Source # 
Instance details

Defined in GI.Gio.Interfaces.Proxy

noProxy :: Maybe Proxy Source #

A convenience alias for Nothing :: Maybe Proxy.

class GObject o => IsProxy o Source #

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

Instances
(GObject a, (UnknownAncestorError Proxy a :: Constraint)) => IsProxy a Source # 
Instance details

Defined in GI.Gio.Interfaces.Proxy

IsProxy Proxy 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

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 Proxy

Returns: return a Proxy or NULL if protocol is not supported.

Lookup "gio-proxy" extension point for a proxy implementation that supports 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