/**
* Custom Proxy Auto-Config
* Generated with Smalltools PAC Generator (https://tools.cjkuo.net/pac-generator/)
* Generated at: 2026-09-18T17:07:23.237Z
* 100% Client-Side & Zero-Server Logging
*/
// ==================== 代理伺服器常數定義 ====================
const PROXY_NODE_1 = "PROXY proxy.company.com:8080"; // 公司外網代理
const PROXY_NODE_2 = "PROXY backup-proxy.company.com:8080"; // 備援外網代理
const DEFAULT_PROXY = "PROXY proxy.company.com:8080";
// ==================== 核心路由函式 ====================
function FindProxyForURL(url, host) {
// 預先轉小寫以確保比對一致性
host = host.toLowerCase();
// [規則 1] 本機無點純主機名 (如 intranet/)
// 說明: 純主機名直接連線
if (isPlainHostName(host)) {
return "DIRECT";
}
// [規則 2] 本機回傳與內部測試網域
// 說明: .local 結尾之 mDNS / 區域網域
if (dnsDomainIs(host, ".local") || host === "local") {
return "DIRECT";
}
// [規則 3] 公司內部網域
// 說明: 公司內網私有網域
if (dnsDomainIs(host, ".corp.internal") || host === "corp.internal") {
return "DIRECT";
}
// [規則 4] 私有 A 類網段 (10.0.0.0/8)
if (isInNet(host, "10.0.0.0", "255.0.0.0")) {
return "DIRECT";
}
// [規則 5] 私有 B 類網段 (172.16.0.0/12)
if (isInNet(host, "172.16.0.0", "255.240.0.0")) {
return "DIRECT";
}
// [規則 6] 私有 C 類網段 (192.168.0.0/16)
if (isInNet(host, "192.168.0.0", "255.255.0.0")) {
return "DIRECT";
}
// [規則 7] IPv6 唯一本地位址 (fc00::/7)
if ((typeof isInNetEx === "function" && isInNetEx(host, "fc00::/7"))) {
return "DIRECT";
}
// [規則 8] IPv6 區域鏈路位址 (fe80::/10)
if ((typeof isInNetEx === "function" && isInNetEx(host, "fe80::/10"))) {
return "DIRECT";
}
// ==================== 預設行為 ====================
return DEFAULT_PROXY;
}