ProxyConfig


class ProxyConfig


Config for setProxyOverride.

Proxy rules should be added using addProxyRule methods. Multiple rules can be used as fallback if a proxy fails to respond (for example, the proxy server is down). Bypass rules can be set for URLs that should not use these settings.

For instance, the following code means that WebView would first try to use proxy1.com for all URLs, if that fails, proxy2.com, and if that fails, it would make a direct connection.

ProxyConfig proxyConfig = new ProxyConfig.Builder().addProxyRule("proxy1.com")
                                                   .addProxyRule("proxy2.com")
                                                   .addDirect()
                                                   .build();

Summary

Nested types

ProxyConfig builder.

Class that holds a scheme filter and a proxy URL.

Constants

const String!

Matches all schemes.

const String!
MATCH_HTTP = "http"

HTTP scheme.

const String!
MATCH_HTTPS = "https"

HTTPS scheme.

Public functions

(Mutable)List<String!>

Returns the current list that holds the bypass rules represented by this object.

(Mutable)List<ProxyConfig.ProxyRule!>

Returns the current list of proxy rules.

Boolean

Returns true if reverse bypass is enabled.

Constants

MATCH_ALL_SCHEMES

Added in 1.1.0
const val MATCH_ALL_SCHEMES = "*": String!

Matches all schemes.

MATCH_HTTP

Added in 1.1.0
const val MATCH_HTTP = "http": String!

HTTP scheme.

MATCH_HTTPS

Added in 1.1.0
const val MATCH_HTTPS = "https": String!

HTTPS scheme.

Public functions

getBypassRules

Added in 1.1.0
fun getBypassRules(): (Mutable)List<String!>

Returns the current list that holds the bypass rules represented by this object.

To add new rules use addBypassRule.

Returns
(Mutable)List<String!>

List of bypass rules

getProxyRules

Added in 1.1.0
fun getProxyRules(): (Mutable)List<ProxyConfig.ProxyRule!>

Returns the current list of proxy rules. Each ProxyRule object holds the proxy URL and the URL schemes for which this proxy is used (one of MATCH_HTTP, MATCH_HTTPS, MATCH_ALL_SCHEMES).

To add new rules use addProxyRule or addProxyRule.

Returns
(Mutable)List<ProxyConfig.ProxyRule!>

List of proxy rules

isReverseBypassEnabled

Added in 1.5.0
fun isReverseBypassEnabled(): Boolean

Returns true if reverse bypass is enabled. Reverse bypass means that only URLs in the bypass list will use these proxy settings. getBypassRules returns the URL list.

See setReverseBypassEnabled for a more detailed description.

Returns
Boolean

reverseBypass