Class DefaultWhiteListParser
- java.lang.Object
-
- com.github.markusbernhardt.proxy.selector.whitelist.DefaultWhiteListParser
-
- All Implemented Interfaces:
WhiteListParser
public class DefaultWhiteListParser extends java.lang.Object implements WhiteListParser
Default implementation for an white list parser. This will support the most common forms of filters found in white lists. The white list is a comma (or space) separated list of domain names or IP addresses. The following section shows some examples. .mynet.com - Filters all host names ending with .mynet.com *.mynet.com - Filters all host names ending with .mynet.com www.mynet.* - Filters all host names starting with www.mynet. 123.12.32.1 - Filters the IP 123.12.32.1 123.12.32.1/255 - Filters the IP range http://www.mynet.com - Filters only HTTP protocol not FTP and no HTTPS Example of a list: .mynet.com, *.my-other-net.org, 123.55.23.222, 123.55.23.0/24 Some info about this topic can be found here: http://kb.mozillazine.org/No_proxy_for http://technet.microsoft.com/en-us/library/dd361953.aspx Note that this implementation does not cover all variations of all browsers but should cover the most used formats.
-
-
Constructor Summary
Constructors Constructor Description DefaultWhiteListParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
isIP4SubnetFilter(java.lang.String token)
Checks if the given token is an IP4 subnet filter.private boolean
isIP6SubnetFilter(java.lang.String token)
Checks if the given token is an IP6 subnet filter.java.util.List<UriFilter>
parseWhiteList(java.lang.String whiteList)
parseWhiteList
-
-
-
Method Detail
-
parseWhiteList
public java.util.List<UriFilter> parseWhiteList(java.lang.String whiteList)
parseWhiteList- Specified by:
parseWhiteList
in interfaceWhiteListParser
- Parameters:
whiteList
- the string to parse.- Returns:
- a list of UriFilters
- See Also:
WhiteListParser.parseWhiteList(java.lang.String)
-
isIP6SubnetFilter
private boolean isIP6SubnetFilter(java.lang.String token)
Checks if the given token is an IP6 subnet filter.- Parameters:
token
- to analyze.- Returns:
- true if it is a valid IP6 subnet filter else false.
-
isIP4SubnetFilter
private boolean isIP4SubnetFilter(java.lang.String token)
Checks if the given token is an IP4 subnet filter.- Parameters:
token
- to analyze.- Returns:
- true if it is a valid IP4 subnet filter else false.
-
-