7.0.1 • Published 2 months ago

pac-resolver v7.0.1

Weekly downloads
2,920,930
License
MIT
Repository
github
Last release
2 months ago

pac-resolver

Generates an asynchronous resolver function from a PAC file

This module accepts a JavaScript String of code, which is meant to be a PAC proxy file, and returns a generated asynchronous FindProxyForURL() function.

Example

Given the PAC proxy file named proxy.pac:

function FindProxyForURL(url, host) {
  if (isInNet(myIpAddress(), "10.1.10.0", "255.255.255.0")) {
    return "PROXY 1.2.3.4:8080";
  } else {
    return "DIRECT";
  }
}

You can consume this PAC file with pac-resolver like so:

import { readFileSync } from 'fs';
import { createPacResolver } from 'pac-resolver';

const FindProxyForURL = createPacResolver(readFileSync('proxy.pac'));

const res = await FindProxyForURL('http://foo.com/');
console.log(res);
// "DIRECT"

API

pac(qjs: QuickJSWASMModule, pacFileContents: string | Buffer, options?: PacResolverOptions) → Function

Returns an asynchronous FindProxyForURL() function based off of the given JS string pacFileContents PAC proxy file. An optional options object may be passed in which respects the following options:

  • filename - String - the filename to use in error stack traces. Defaults to proxy.pac.
  • sandbox - Object - a map of functions to include in the sandbox of the JavaScript environment where the JS code will be executed. i.e. if you wanted to include the common alert function you could pass alert: console.log. For async functions, you must set the async = true property on the function instance, and the JS code will be able to invoke the function as if it were synchronous.

    The qjs parameter is a QuickJS module instance as returned from getQuickJS() from the quickjs-emscripten module.

pac-proxy-agenteasy-select-rnreact-native-printer-brothersreact-native-shekhar-bridge-test@oiti/documentoscopy-react-nativequoc-testluminos-ui-core@everything-registry/sub-chunk-2398jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_samplereact-native-animate-textreact-native-android-video-player-viewreact-native-badge-controlreact-native-basic-appreact-native-basic-screenreact-native-bubble-chartreact-native-create-video-thumbnailreact-native-cplusreact-native-build-vesion-getterreact-native-additionreact-native-arps-authorize-netreact-native-bluetooth-device-detectreact-native-bleccs-componentsreact-native-check-componentreact-native-chenaarreact-native-conekta-card-tokenizerreact-native-components-designsemantic-release-gitmoji-actionscout-chatbot-widgetsteamhourapireact-native-recent-framework-updatereact-native-reanimated-sortable-listreact-native-rom-componentsreact-native-get-countriesreact-native-innity-2react-native-innity-remasterreact-native-input-libraryreact-native-omental-frameworkreact-native-onrampreact-native-screen-idle-timerreact-native-scroll-tab-to-indexreact-native-return-usb-datareact-native-rn-icons-libraryreact-native-rn-appreact-native-rtn-ips-poslin-testreact-native-savczuk-feature-libraryreact-native-sandycomponentreact-native-ghn-ekycreact-native-dimensions-layoutreact-native-dhp-printerreact-native-ctp-odpreact-native-fedlight-dsmreact-native-jsi-device-infodohunreact-native-uvc-camera-androidreact-native-xprinter-thermal-blereact-native-wtfreact-native-auth-service-clientreact-native-app-bubblereact-native-app-integrity-checksumdemo-test-scrnreact-native-awesome-android-123react-native-awesome-android-123-zeotapreact-native-aventonfacetec-aventonreact-native-azure-communication-servicesreact-native-awesome-module-latestreact-native-awesome-module-tworeact-native-bridge-packagereact-native-manh-testreact-native-manual-ios-sdkreact-native-nativewindreact-native-klarify-iosreact-native-klarify-uireact-native-loyalty-platformsreact-native-lowlatencyreact-native-nghia-shareringreact-native-nice-learningreact-native-radio-bic-group-libreact-native-rabbitmq-allreact-native-volume-phisicalreact-native-withframework-checkdogandev-simple-toastreact-native-version-appreact-native-module-argereact-native-module-for-testingreact-native-native-ios-test1react-native-native-audio-enginereact-native-login-demo-test@damruravihara/react-native-testing-packagequickcapture_react_nativereat-native-multiplierkprrn_unique_device_idscanossreactnativelyrn-agora-ios-m
7.0.1

2 months ago

6.0.2

10 months ago

7.0.0

9 months ago

6.0.1

12 months ago

6.0.0

12 months ago

5.0.1

2 years ago

5.0.0

3 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.1.0

4 years ago

4.0.0

4 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.3.0

8 years ago

1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago