-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpacservers.js
More file actions
25 lines (20 loc) · 750 Bytes
/
pacservers.js
File metadata and controls
25 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
import http from 'node:http';
const DIRECT_PORT = 8082;
const PROXY_PORT = 8083;
const serverDirect = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('function FindProxyForURL(url, host) {return "DIRECT"; }\n');
});
serverDirect.listen(DIRECT_PORT, 'localhost', () => {
console.log(`Server direct running at ${DIRECT_PORT}`);
});
const serverProxy = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('function FindProxyForURL(url, host) {return "PROXY localhost:8084";}\n');
});
serverProxy.listen(PROXY_PORT, 'localhost', () => {
console.log(`Server proxy running at ${PROXY_PORT}`);
});