Package org.gnome.gio
Interface Proxy
- All Superinterfaces:
Proxy
- All Known Implementing Classes:
Proxy.ProxyImpl
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
IOExtensionPoint.getExtensionByName(java.lang.String)
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The ProxyImpl type represents a native instance of the Proxy interface.static class
Provides an interface for handling proxy connection and payload. -
Method Summary
Modifier and TypeMethodDescriptiondefault IOStream
connect
(IOStream connection, ProxyAddress proxyAddress, @Nullable Cancellable cancellable) Givenconnection
to communicate with a proxy (eg, aGSocketConnection
that is connected to the proxy server), this does the necessary handshake to connect toproxyAddress
, and if required, wraps theGIOStream
to handle proxy payload.default void
connectAsync
(IOStream connection, ProxyAddress proxyAddress, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronous version of g_proxy_connect().default IOStream
connectFinish
(AsyncResult result) See g_proxy_connect().static Proxy
getDefaultForProtocol
(String protocol) Find thegio-proxy
extension point for a proxy implementation that supports the specified protocol.static Type
getType()
Get the GType of the Proxy classdefault boolean
Some proxy protocols expect to be passed a hostname, which they will resolve to an IP address themselves.
-
Method Details
-
getType
-
getDefaultForProtocol
-
connect
default IOStream connect(IOStream connection, ProxyAddress proxyAddress, @Nullable @Nullable Cancellable cancellable) throws GErrorException Givenconnection
to communicate with a proxy (eg, aGSocketConnection
that is connected to the proxy server), this does the necessary handshake to connect toproxyAddress
, and if required, wraps theGIOStream
to handle proxy payload.- Parameters:
connection
- aGIOStream
proxyAddress
- aGProxyAddress
cancellable
- aGCancellable
- Returns:
- a
GIOStream
that will replaceconnection
. This might be the same asconnection
, in which case a reference will be added. - Throws:
GErrorException
- seeGError
-
connectAsync
default void connectAsync(IOStream connection, ProxyAddress proxyAddress, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Asynchronous version of g_proxy_connect().- Parameters:
connection
- aGIOStream
proxyAddress
- aGProxyAddress
cancellable
- aGCancellable
callback
- aGAsyncReadyCallback
-
connectFinish
See g_proxy_connect().- Parameters:
result
- aGAsyncResult
- Returns:
- a
GIOStream
. - Throws:
GErrorException
- seeGError
-
supportsHostname
default boolean supportsHostname()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 returnfalse
if this Proxy is implementing such a protocol. Whenfalse
is returned, the caller should resolve the destination hostname first, and then pass aGProxyAddress
containing the stringified IP address to g_proxy_connect() or g_proxy_connect_async().- Returns:
true
if hostname resolution is supported.
-