public final class CustomProxyConfig extends java.lang.Object implements ProxyConfig
Modifier and Type | Method and Description |
---|---|
java.lang.String |
exceptions()
Returns a string that represents the proxy exceptions or an empty string if there are no
exceptions.
|
static CustomProxyConfig |
newInstance(java.lang.String proxyRules)
Creates a custom proxy configuration based on the given
proxyRules . |
static CustomProxyConfig |
newInstance(java.lang.String proxyRules,
java.lang.String proxyExceptions)
Creates a custom proxy configuration based on the given
proxyRules and proxyExceptions . |
java.lang.String |
proxyRules()
Returns a string that represents the proxy rules.
|
public static CustomProxyConfig newInstance(java.lang.String proxyRules)
proxyRules
.
The examples of the proxy rules:
"http=foopy:80;ftp=foopy2"
- use HTTP proxy "foopy:80" for http:// URLs,
and HTTP proxy "foopy2:80" for ftp:// URLs.
"foopy:80"
- use HTTP proxy "foopy:80" for all URLs.
"socks4://foopy"
- use SOCKS v4 proxy "foopy:1080" for all URLs.
proxyRules
- a string that represents the proxy rules in the described formatjava.lang.IllegalArgumentException
- when proxyRules
is empty or blankpublic static CustomProxyConfig newInstance(java.lang.String proxyRules, java.lang.String proxyExceptions)
proxyRules
and proxyExceptions
.
The examples of the proxy rules:
"http=foopy:80;ftp=foopy2"
- use HTTP proxy "foopy:80" for http:// URLs,
and HTTP proxy "foopy2:80" for ftp:// URLs.
"foopy:80"
- use HTTP proxy "foopy:80" for all URLs.
"socks4://foopy"
- use SOCKS v4 proxy "foopy:1080" for all URLs.
The format of the exceptions can be any of the following:
[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]
. Examples: "foobar.com",
"*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99"
"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]
. Examples: ".google.com", ".com",
"http://.google.com"
[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]
. Examples: "127.0.1", "[0:0::1]",
"[::1]", "http://[::1]:99"
IP_LITERAL "/" PREFIX_LENGHT_IN_BITS
. Examples: "192.168.1.1/16",
"fefe:13::abc/33"
"<local>"
. Match local addresses. The meaning of "<local>"
is whether
the host matches one of: "127.0.0.1", "::1", "localhost".
If you need to provide several exception rules you can separate them using comma: "*foobar.com,.google.com,<local>"
.
proxyRules
- a string that represents the proxy rules in the described formatproxyExceptions
- a string that represents the proxy exceptions in the described formatjava.lang.IllegalArgumentException
- when proxyRules
is empty or blankpublic java.lang.String exceptions()
public java.lang.String proxyRules()