Skip to content

Commit b901de9

Browse files
authored
add dist to gitignore, rebase commits, convert code to es6, convert to typescript (#259)
1 parent 373b623 commit b901de9

File tree

19 files changed

+3571
-3159
lines changed

19 files changed

+3571
-3159
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ node_modules
77
npm-debug.log
88
.idea
99
.http-mitm-proxy
10-
.vscode
10+
.vscode
11+
dist

bin/mitm-proxy.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

bin/mitm-proxy.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /usr/bin/env node --experimental-specifier-resolution=node
2+
import yargs from "yargs";
3+
import { hideBin } from "yargs/helpers";
4+
5+
import d from "debug";
6+
const debug = d("http-mitm-proxy:bin");
7+
import Proxy from "../lib/proxy";
8+
const proxy = new Proxy();
9+
10+
const args = yargs(hideBin(process.argv))
11+
.alias("h", "help")
12+
.alias("h", "?")
13+
.options("port", {
14+
default: 80,
15+
describe: "HTTP Port.",
16+
})
17+
.alias("p", "port")
18+
.options("host", {
19+
describe: "HTTP Listen Interface.",
20+
}).argv;
21+
22+
if (args.help) {
23+
yargs.showHelp();
24+
process.exit(-1);
25+
}
26+
27+
proxy.onError((ctx, err, errorKind) => {
28+
debug(errorKind, err);
29+
});
30+
proxy.listen(args, (err) => {
31+
if (err) {
32+
debug(`Failed to start listening on port ${args.port}`, err);
33+
process.exit(1);
34+
}
35+
debug(`proxy listening on ${args.port}`);
36+
});

index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import proxy from './lib/proxy'
2+
3+
export default proxy;

lib/ca.js

Lines changed: 0 additions & 245 deletions
This file was deleted.

0 commit comments

Comments
 (0)