-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dist to gitignore, rebase commits, convert code to es6, convert t…
…o typescript (#259)
- Loading branch information
Showing
19 changed files
with
3,571 additions
and
3,159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ node_modules | |
npm-debug.log | ||
.idea | ||
.http-mitm-proxy | ||
.vscode | ||
.vscode | ||
dist |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /usr/bin/env node --experimental-specifier-resolution=node | ||
import yargs from "yargs"; | ||
import { hideBin } from "yargs/helpers"; | ||
|
||
import d from "debug"; | ||
const debug = d("http-mitm-proxy:bin"); | ||
import Proxy from "../lib/proxy"; | ||
const proxy = new Proxy(); | ||
|
||
const args = yargs(hideBin(process.argv)) | ||
.alias("h", "help") | ||
.alias("h", "?") | ||
.options("port", { | ||
default: 80, | ||
describe: "HTTP Port.", | ||
}) | ||
.alias("p", "port") | ||
.options("host", { | ||
describe: "HTTP Listen Interface.", | ||
}).argv; | ||
|
||
if (args.help) { | ||
yargs.showHelp(); | ||
process.exit(-1); | ||
} | ||
|
||
proxy.onError((ctx, err, errorKind) => { | ||
debug(errorKind, err); | ||
}); | ||
proxy.listen(args, (err) => { | ||
if (err) { | ||
debug(`Failed to start listening on port ${args.port}`, err); | ||
process.exit(1); | ||
} | ||
debug(`proxy listening on ${args.port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import proxy from './lib/proxy' | ||
|
||
export default proxy; |
Oops, something went wrong.