pacrunner

A simple util helps testing PAC file


License
0BSD
Install
npm install pacrunner@0.4.0

Documentation

PACRunner

Build Status Coverage Status npm version

Run PAC file in specific context.

Example

Demo project

Assume a PAC "template" file template.pac, some variable is replaced to real value on server side. (So it can't directly run in JS engine):

// template.pac
// _HOST and _PROXY will replaced with real value before send to client. 
function FindProxyForURL(url, host) {
	if (host == _HOST) return _PROXY;
	return 'DIRECT;';
}
import { PAC } from 'pacrunner';

console.log(
	PAC.FromFile('template.pac').Run('https://exhentai.org/img/kokomade.jpg', {
		_HOST: 'exhentai.org',
		_PROXY: 'SOCKS 127.0.0.1:1080;'
	})
);
// console: 'SOCKS 127.0.0.1:1080;'