Class ProxyUtil
java.lang.Object
com.github.markusbernhardt.proxy.util.ProxyUtil
Small helper class for some common utility methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PacProxySelector
Build a PAC proxy selector for the given URL.static String
This method can be used to cleanup an IPv6 address.Gets an unmodifiable proxy list that will have as it's only entry an DIRECT proxy.static FixedProxySelector
parseProxySettings
(String proxyVar) Parse host and port out of a proxy variable.
-
Field Details
-
DEFAULT_PROXY_PORT
public static final int DEFAULT_PROXY_PORT- See Also:
-
noProxyList
-
-
Constructor Details
-
ProxyUtil
public ProxyUtil()
-
-
Method Details
-
parseProxySettings
Parse host and port out of a proxy variable.- Parameters:
proxyVar
- the proxy string. example: http://192.168.10.9:8080/- Returns:
- a FixedProxySelector using this settings, null on parse error.
-
noProxyList
Gets an unmodifiable proxy list that will have as it's only entry an DIRECT proxy.- Returns:
- a list with a DIRECT proxy in it.
-
buildPacSelectorForUrl
Build a PAC proxy selector for the given URL.- Parameters:
url
- to fetch the PAC script from.- Returns:
- a PacProxySelector or null if it is not possible to build a working selector.
-
cleanIPv6
This method can be used to cleanup an IPv6 address. It will remove the surrounding square brackets if found. e.g. [2001:4860:0:2001::68] will be returned as 2001:4860:0:2001::68- Parameters:
hostOrIP
- to cleanup- Returns:
- the raw host or IP without any IPv6 brackets.
-