Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

isUrlMatchingNoProxy.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _url = require("url");
  7. var _matcher = _interopRequireDefault(require("matcher"));
  8. var _errors = require("../errors");
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. const isUrlMatchingNoProxy = (subjectUrl, noProxy) => {
  11. const subjectUrlTokens = (0, _url.parse)(subjectUrl);
  12. const rules = noProxy.split(/[\s,]+/);
  13. for (const rule of rules) {
  14. const ruleMatch = rule.replace(/^(?<leadingDot>\.)/, '*').match(/^(?<hostname>.+?)(?::(?<port>\d+))?$/);
  15. if (!ruleMatch || !ruleMatch.groups) {
  16. throw new _errors.UnexpectedStateError('Invalid NO_PROXY pattern.');
  17. }
  18. if (!ruleMatch.groups.hostname) {
  19. throw new _errors.UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');
  20. }
  21. const hostnameIsMatch = _matcher.default.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);
  22. if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {
  23. return true;
  24. }
  25. }
  26. return false;
  27. };
  28. var _default = isUrlMatchingNoProxy;
  29. exports.default = _default;
  30. //# sourceMappingURL=isUrlMatchingNoProxy.js.map