Skip to main content

ProxyExt

Trait ProxyExt 

Source
pub trait ProxyExt: IsA<Proxy> + 'static {
    // Provided methods
    fn connect(
        &self,
        connection: &impl IsA<IOStream>,
        proxy_address: &impl IsA<ProxyAddress>,
        cancellable: Option<&impl IsA<Cancellable>>,
    ) -> Result<IOStream, Error> { ... }
    fn connect_async<P>(
        &self,
        connection: &impl IsA<IOStream>,
        proxy_address: &impl IsA<ProxyAddress>,
        cancellable: Option<&impl IsA<Cancellable>>,
        callback: P,
    )
       where P: FnOnce(Result<IOStream, Error>) + 'static { ... }
    fn connect_future(
        &self,
        connection: &(impl IsA<IOStream> + Clone + 'static),
        proxy_address: &(impl IsA<ProxyAddress> + Clone + 'static),
    ) -> Pin<Box<dyn Future<Output = Result<IOStream, Error>>>> { ... }
    fn supports_hostname(&self) -> bool { ... }
}
Expand description

Trait containing all Proxy methods.

§Implementors

Proxy

Provided Methods§

Source

fn connect( &self, connection: &impl IsA<IOStream>, proxy_address: &impl IsA<ProxyAddress>, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<IOStream, Error>

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

§connection

a #GIOStream

§proxy_address

a #GProxyAddress

§cancellable

a #GCancellable

§Returns

a #GIOStream that will replace @connection. This might be the same as @connection, in which case a reference will be added.

Source

fn connect_async<P>( &self, connection: &impl IsA<IOStream>, proxy_address: &impl IsA<ProxyAddress>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
where P: FnOnce(Result<IOStream, Error>) + 'static,

Asynchronous version of g_proxy_connect().

§connection

a #GIOStream

§proxy_address

a #GProxyAddress

§cancellable

a #GCancellable

§callback

a #GAsyncReadyCallback

Source

fn connect_future( &self, connection: &(impl IsA<IOStream> + Clone + 'static), proxy_address: &(impl IsA<ProxyAddress> + Clone + 'static), ) -> Pin<Box<dyn Future<Output = Result<IOStream, Error>>>>

Source

fn supports_hostname(&self) -> 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 #GProxyAddress containing the stringified IP address to g_proxy_connect() or g_proxy_connect_async().

§Returns

true if hostname resolution is supported.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<O> ProxyExt for O
where O: IsA<Proxy>,