Skip to content

komsomolskinari/pacrunner

Repository files navigation

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;'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published