Class SimpleProxyResolver

All Implemented Interfaces:
ProxyResolver, Proxy

@Generated("org.javagi.JavaGI") public class SimpleProxyResolver extends GObject implements ProxyResolver

GSimpleProxyResolver 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.

GSimpleProxyResolver 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 SocketClient.setProxyResolver(ProxyResolver).

Since:
2.36
  • Constructor Details

    • SimpleProxyResolver

      public SimpleProxyResolver(MemorySegment address)
      Create a SimpleProxyResolver instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • SimpleProxyResolver

      public SimpleProxyResolver()
      Create a new SimpleProxyResolver.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the SimpleProxyResolver class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected SimpleProxyResolver asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • new_

      public static ProxyResolver new_(@Nullable String defaultProxy, @Nullable String @Nullable [] ignoreHosts)
      Creates a new GSimpleProxyResolver. See GSimpleProxyResolver:default-proxy and GSimpleProxyResolver:ignore-hosts for more details on how the arguments are interpreted.
      Parameters:
      defaultProxy - the default proxy to use, eg "socks://192.168.1.1"
      ignoreHosts - an optional list of hosts/IP addresses to not use a proxy for.
      Returns:
      a new GSimpleProxyResolver
      Since:
      2.36
    • setDefaultProxy

      public void setDefaultProxy(@Nullable String defaultProxy)

      Sets the default proxy on resolver, to be used for any URIs that don't match GSimpleProxyResolver:ignore-hosts or a proxy set via g_simple_proxy_resolver_set_uri_proxy().

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

      Parameters:
      defaultProxy - the default proxy to use
      Since:
      2.36
    • setIgnoreHosts

      public void setIgnoreHosts(@Nullable String @Nullable [] ignoreHosts)

      Sets the list of ignored hosts.

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

      Parameters:
      ignoreHosts - null-terminated list of hosts/IP addresses to not use a proxy for
      Since:
      2.36
    • setUriProxy

      public void setUriProxy(String uriScheme, String proxy)

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

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

      Parameters:
      uriScheme - the URI scheme to add a proxy for
      proxy - the proxy to use for uriScheme
      Since:
      2.36
    • builder

      public static SimpleProxyResolver.Builder<? extends SimpleProxyResolver.Builder> builder()
      A SimpleProxyResolver.Builder object constructs a SimpleProxyResolver with the specified properties. Use the various set...() methods to set properties, and finish construction with SimpleProxyResolver.Builder.build().
      Returns:
      the builder object