pac-resolver-gh-3.expected.js 625 B

123456789101112131415161718192021222324
  1. function* FindProxyForURL(url, host) {
  2. if (yield isHostInAnySubnet(host, [
  3. '10.1.2.0',
  4. '10.1.3.0'
  5. ], '255.255.255.0')) {
  6. return 'HTTPS proxy.example.com';
  7. }
  8. if (yield isHostInAnySubnet(host, [
  9. '10.2.2.0',
  10. '10.2.3.0'
  11. ], '255.255.255.0')) {
  12. return 'HTTPS proxy.example.com';
  13. }
  14. return 'DIRECT';
  15. }
  16. function* isHostInAnySubnet(host, subnets, mask) {
  17. var subnets_length = subnets.length;
  18. for (i = 0; i < subnets_length; i++) {
  19. if (yield isInNet(host, subnets[i], mask)) {
  20. return true;
  21. }
  22. }
  23. }