Skip to content

Commit 4dccc7a

Browse files

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PAC scripts for proxies
1717
- `pac-<name>.txt` 包含从数据源 `<name>` 获取的 IP 地址列表(白名单)
1818
- `pad-gfwlist-<name>.txt` 在 IP 白名单的基础上添加了 GFWList 的匹配
1919

20-
本代码是为 Shadowsocks Windows 4.1.9 及以上版本设计的,若要在旧版本中使用(或使用其他代理软件)请手动修改代码第 4`__PROXY__` 为你的代理地址,详情见 [shadowsocks-windows#2761](https://github.com/shadowsocks/shadowsocks-windows/issues/2761)
20+
本代码是为 Shadowsocks Windows 4.1.9 及以上版本设计的,若要在旧版本或使用其他代理软件中使用,请手动修改文件第 5`__PROXY__` 为你的代理地址,详情见 [shadowsocks-windows#2761](https://github.com/shadowsocks/shadowsocks-windows/issues/2761)
2121

2222
## 贡献
2323

code.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// Author: iBug <ibugone.com>
1+
// Author: iBug <ibug.io>
2+
// Source: https://github.com/iBug/pac
23
// Time: @@TIME@@
34

45
var proxy = __PROXY__;
56
var direct = "DIRECT";
67

78
function belongsToSubnet(host, list) {
8-
var ip = host.split(".").map(Number);
9-
ip = 0x1000000 * ip[0] + 0x10000 * ip[1] + 0x100 * ip[2] + ip[3];
9+
var ip = convert_addr(host) >>> 0;
1010

11-
if (ip < list[0][0])
11+
if (list.length === 0 || ip < list[0][0])
1212
return false;
1313

1414
// Binary search
@@ -23,7 +23,7 @@ function belongsToSubnet(host, list) {
2323

2424
// Match
2525
var masked = ip & list[x][1];
26-
return (masked ^ list[x][0]) == 0;
26+
return (masked ^ list[x][0]) === 0;
2727
}
2828

2929
function hasMatchedPattern(text, patterns) {

0 commit comments

Comments
 (0)