You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pac-resolver-gh-3.js 683B

1234567891011121314151617181920212223
  1. // FindProxyForURL, isInNet
  2. function FindProxyForURL(url, host) {
  3. if (isHostInAnySubnet(host, ['10.1.2.0', '10.1.3.0'], '255.255.255.0')) {
  4. return "HTTPS proxy.example.com";
  5. }
  6. if (isHostInAnySubnet(host, ['10.2.2.0', '10.2.3.0'], '255.255.255.0')) {
  7. return "HTTPS proxy.example.com";
  8. }
  9. // Everything else, go direct:
  10. return "DIRECT";
  11. }
  12. // Checks if the single host is within a list of subnets using the single mask.
  13. function isHostInAnySubnet(host, subnets, mask) {
  14. var subnets_length = subnets.length;
  15. for (i = 0; i < subnets_length; i++) {
  16. if (isInNet(host, subnets[i], mask)) {
  17. return true;
  18. }
  19. }
  20. }