IE代理自动配置脚本 PAC Functions Explained

原文:http://findproxyforurl.com/pac_functions_explained.html

PAC Functions Explained

 

isPlainHostName()

This function will return true if the hostname contains no dots, e.g. http://intranet
Useful when applying exceptions for internal websites, e.g. may not require resolution of a hostname to IP address to determine if local.

Example:

if (isPlainHostName(host)) return "DIRECT";

 

 

dnsDomainIs()

Evaluates hostnames and returns true if hostnames match. Used mainly to match and exception individual hostnames.

Example:

if (dnsDomainIs(host, ".google.com")) return "DIRECT";

 

 

localHostOrDomainIs()

Evaluates hostname and only returns true if exact hostname match is found.

Example:

if (localHostOrDomainIs(host, "www.google.com")) return "DIRECT";

 

 

isResolvable()

Attempts to resolve a hostname to an IP address and returns true if successful. WARNING - This may cause a browser to temporarily hang if a domain isn't resolvable.

Example:

if (isResolvable(host)) return "PROXY proxy1.example.com:8080";

 

 

isInNet()

This function evaluates the IP address of a hostname, and if within a specified subnet returns true. If a hostname is passed the function will resolve the hostname to an IP address.

Example:

if (isInNet(host, "172.16.0.0", "255.240.0.0")) return "DIRECT";

 

 

dnsResolve()

Resolves hostnames to an IP address. This function can be used to reduce the number of DNS lookups, e.g. below example.

Example:

var resolved_ip = dnsResolve(host);

if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
	isInNet(resolved_ip, "172.16.0.0",  "255.240.0.0") ||
	isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
	isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
	return "DIRECT";

 

 

myIpAddress()

Returns the IP address of the host machine.

Example:

if (isInNet(myIpAddress(), "10.10.1.0", "255.255.255.0")) return "DIRECT";

 

 

dnsDomainLevels()

This function returns the number of DNS domain levels (number of dots) in the hostname. Can be used to exception internal websites which use short DNS names, e.g. http://intranet

Example:

if (dnsDomainLevels(host) > 0) return "PROXY proxy1.example.com:8080";
	else return "DIRECT";

 

 

shExpMatch()

Will attempt to match hostname or URL to a specified shell expression, and returns true if matched.

Example:

if (shExpMatch(url, "*vpn.domain.com*") ||
	shExpMatch(url, "*abcdomain.com/folder/*")) return "DIRECT";

 

 

weekdayRange()

Can be used to specify different proxies for a specific day range. Note example would utilize 'proxy1.example.com' Monday through Friday.

Example:

if (weekdayRange("MON", "FRI")) return "PROXY proxy1.example.com:8080";
	else return "DIRECT";

 

 

dateRange()

Can be used to specify different proxies for a specific date range. Note example would utilize 'proxy1.example.com' January through March.

Example:

if (dateRange("JAN", "MAR")) return "PROXY proxy1.example.com:8080";
	else return "DIRECT";

 

 

timeRange()

Can be used to specify different proxies for a specific time range. Note example would utilize 'proxy1.example.com' 8am through to 6pm.

Example:

if (timeRange(8, 18)) return "PROXY proxy1.example.com:8080";
	else return "DIRECT";
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值