public class PacScriptMethods extends Object implements ScriptMethods
| Modifier and Type | Field and Description |
|---|---|
static String |
OVERRIDE_LOCAL_IP |
| Constructor and Description |
|---|
PacScriptMethods()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
dateRange(Object day1,
Object month1,
Object year1,
Object day2,
Object month2,
Object year2,
Object gmt)
Only the first parameter is mandatory.
|
boolean |
dnsDomainIs(String host,
String domain)
Tests if an URL is in a given domain.
|
int |
dnsDomainLevels(String host)
Returns the number of DNS domain levels (number of dots) in the host
name.
|
String |
dnsResolve(String host)
Resolves the given DNS host name into an IP address, and returns it in
the dot separated format as a string.
|
String |
dnsResolveEx(String host)
dnsResolveEx
|
String |
getClientVersion()
getClientVersion
|
boolean |
isInNet(String host,
String pattern,
String mask)
Returns true if the IP address of the host matches the specified IP
address pattern.
|
boolean |
isInNetEx(String ipOrHost,
String cidr)
isInNetEx Implementation from
http://fhanik.blogspot.ch/2013/11/ip-magic-check-if-ipv6-address-is.html
|
boolean |
isPlainHostName(String host)
isPlainHostName
|
boolean |
isResolvable(String host)
Tries to resolve the host name.
|
boolean |
isResolvableEx(String host)
isResolvableEx
|
boolean |
localHostOrDomainIs(String host,
String domain)
Is true if the host name matches exactly the specified host name, or if
there is no domain name part in the host name, but the unqualified host
name matches.
|
String |
myIpAddress()
Returns the IP address of the host that the process is running on, as a
string in the dot-separated integer format.
|
String |
myIpAddressEx()
myIpAddressEx
|
void |
setCurrentTime(Calendar cal)
Sets a calendar with the current time.
|
boolean |
shExpMatch(String str,
String shexp)
Returns true if the string matches the specified shell expression.
|
String |
sortIpAddressList(String ipAddressList)
sortIpAddressList
|
boolean |
timeRange(Object hour1,
Object min1,
Object sec1,
Object hour2,
Object min2,
Object sec2,
Object gmt)
Some parameters can be left out therefore the meaning of the parameters
changes.
|
boolean |
weekdayRange(String wd1,
String wd2,
String gmt)
Only the first parameter is mandatory.
|
public static final String OVERRIDE_LOCAL_IP
public boolean isPlainHostName(String host)
isPlainHostName in interface ScriptMethodsScriptMethods.isPlainHostName(java.lang.String)public boolean dnsDomainIs(String host, String domain)
dnsDomainIs in interface ScriptMethodshost - is the host name from the URL.domain - is the domain name to test the host name against.public boolean localHostOrDomainIs(String host, String domain)
localHostOrDomainIs in interface ScriptMethodshost - the host name from the URL.domain - fully qualified host name with domain to match against.public boolean isResolvable(String host)
isResolvable in interface ScriptMethodshost - is the host name from the URL.public boolean isInNet(String host, String pattern, String mask)
isInNet in interface ScriptMethodshost - a DNS host name, or IP address. If a host name is passed, it
will be resolved into an IP address by this function.pattern - an IP address pattern in the dot-separated format.mask - mask for the IP address pattern informing which parts of the
IP address should be matched against. 0 means ignore, 255
means match.public String dnsResolve(String host)
dnsResolve in interface ScriptMethodshost - the host to resolve.public String myIpAddress()
myIpAddress in interface ScriptMethodspublic int dnsDomainLevels(String host)
dnsDomainLevels in interface ScriptMethodshost - is the host name from the URL.public boolean shExpMatch(String str, String shexp)
shExpMatch in interface ScriptMethodsstr - is any string to compare (e.g. the URL, or the host name).shexp - is a shell expression to compare against.public boolean weekdayRange(String wd1, String wd2, String gmt)
weekdayRange in interface ScriptMethodswd1 - weekday 1 is one of SUN MON TUE WED THU FRI SATwd2 - weekday 2 is one of SUN MON TUE WED THU FRI SATgmt - "GMT" for gmt time format else "undefined"public void setCurrentTime(Calendar cal)
cal - a Calendar to set.public boolean dateRange(Object day1, Object month1, Object year1, Object day2, Object month2, Object year2, Object gmt)
dateRange in interface ScriptMethodsday1 - is the day of month between 1 and 31 (as an integer).month1 - one of JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DECyear1 - is the full year number, for example 1995 (but not 95).
Integer.day2 - is the day of month between 1 and 31 (as an integer).month2 - one of JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DECyear2 - is the full year number, for example 1995 (but not 95).
Integer.gmt - "GMT" for gmt time format else "undefined"public boolean timeRange(Object hour1, Object min1, Object sec1, Object hour2, Object min2, Object sec2, Object gmt)
timeRange(hour) timeRange(hour1, hour2) timeRange(hour1, min1, hour2, min2) timeRange(hour1, min1, sec1, hour2, min2, sec2) timeRange(hour1, min1, sec1, hour2, min2, sec2, gmt)
timeRange in interface ScriptMethodshour1 - is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.)min1 - minutes from 0 to 59.sec1 - seconds from 0 to 59.hour2 - is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.)min2 - minutes from 0 to 59.sec2 - seconds from 0 to 59.gmt - "GMT" for gmt time format else "undefined"public boolean isResolvableEx(String host)
isResolvableEx in interface ScriptMethodshost - is the host name from the URL.ScriptMethods.isResolvableEx(java.lang.String)public boolean isInNetEx(String ipOrHost, String cidr)
isInNetEx in interface ScriptMethodsipOrHost - an IP4 or IP6 addresscidr - A string containing colon delimited IP prefix with top n bits
specified in the bit field (i.e. 3ffe:8311:ffff::/48 or
123.112.0.0/16).ScriptMethods.isInNetEx(java.lang.String,
java.lang.String)public String dnsResolveEx(String host)
dnsResolveEx in interface ScriptMethodshost - the host to resolveScriptMethods.dnsResolveEx(java.lang.String)public String myIpAddressEx()
myIpAddressEx in interface ScriptMethodsScriptMethods.myIpAddressEx()public String sortIpAddressList(String ipAddressList)
sortIpAddressList in interface ScriptMethodsipAddressList - the address list.ScriptMethods.sortIpAddressList(java.lang.String)public String getClientVersion()
getClientVersion in interface ScriptMethodsScriptMethods.getClientVersion()Copyright © 2020. All rights reserved.