Class WpadProxySearchStrategy
- java.lang.Object
-
- com.github.markusbernhardt.proxy.search.wpad.WpadProxySearchStrategy
-
- All Implemented Interfaces:
ProxySearchStrategy
public class WpadProxySearchStrategy extends java.lang.Object implements ProxySearchStrategy
Uses automatic proxy script search (WPAD) to find an PAC file automatically.Note: at the moment only the DNS name guessing schema is implemented. All others are missing.
For more information about WPAD: Web_Proxy_Autodiscovery_Protocol
Outdated RFC draft: draft-ietf-wrec-wpad-01.txt
-
-
Constructor Summary
Constructors Constructor Description WpadProxySearchStrategy()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
checkDhcpAckForPAC(java.net.InetAddress ip, byte[] mac)
private java.lang.String
detectScriptUrlPerDHCP()
Uses DHCP to find the script URL.private java.lang.String
detectScriptUrlPerDNS()
Uses DNS to find the script URL.private java.lang.String
getMacString(byte[] mac)
java.lang.String
getName()
Gets the printable name of the search strategy.java.net.ProxySelector
getProxySelector()
Loads the proxy settings from a PAC file.java.util.Properties
readSettings()
Loads the settings and stores them in a properties map.
-
-
-
Method Detail
-
getProxySelector
public java.net.ProxySelector getProxySelector() throws ProxyException
Loads the proxy settings from a PAC file. The location of the PAC file is determined automatically.- Specified by:
getProxySelector
in interfaceProxySearchStrategy
- Returns:
- a configured ProxySelector, null if none is found.
- Throws:
ProxyException
- on error.
-
getName
public java.lang.String getName()
Gets the printable name of the search strategy.- Specified by:
getName
in interfaceProxySearchStrategy
- Returns:
- the printable name of the search strategy
-
readSettings
public java.util.Properties readSettings()
Loads the settings and stores them in a properties map.- Returns:
- the settings.
-
detectScriptUrlPerDNS
private java.lang.String detectScriptUrlPerDNS() throws java.io.IOException
Uses DNS to find the script URL. Attention: this detection method is known to have some severe security issues.- Returns:
- the URL, null if not found.
- Throws:
java.io.IOException
-
detectScriptUrlPerDHCP
private java.lang.String detectScriptUrlPerDHCP() throws java.io.IOException
Uses DHCP to find the script URL.- Returns:
- the URL, null if not found.
- Throws:
java.io.IOException
-
getMacString
private java.lang.String getMacString(byte[] mac)
-
checkDhcpAckForPAC
private java.lang.String checkDhcpAckForPAC(java.net.InetAddress ip, byte[] mac) throws java.io.IOException
- Throws:
java.io.IOException
-
-