New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite core proxy, TLS MITM support, and refactor all the things. #13
Conversation
) | ||
|
||
var ( | ||
addr = flag.String("addr", ":8080", "host:port of the proxy") | ||
apiAddr = flag.String("api-addr", ":0", "host:port of the configuration API") | ||
apiHostname = flag.String("api-hostname", "martian.proxy", "hostname forwarded to apiAddr") | ||
generateCert = flag.Bool("generate-cert", false, "generate certificate and private key for MITM") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "CA" to message and we should document the use case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// TODO: Avoid creating real connection, spin up TLS server with fake | ||
// certificate signed by generated CA. | ||
// | ||
// GET /humans.text HTTP/1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
humans.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
strings rather than regexes.
@@ -110,30 +96,44 @@ func (f *Filter) ResponseModifier(id string) martian.ResponseModifier { | |||
|
|||
// ModifyRequest runs the RequestModifier for the associated ctx.Auth.ID. If no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment - no longer ctx.Auth.ID, it's actx.ID()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
func (f *Filter) ModifyResponse(ctx *martian.Context, res *http.Response) error { | ||
if resmod := f.resmods[ctx.Auth.ID]; resmod != nil { | ||
return resmod.ModifyResponse(ctx, res) | ||
func (f *Filter) ModifyResponse(res *http.Response) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment - no longer ctx.Auth.ID, it's actx.ID()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Rewrite core proxy, TLS MITM support, and refactor all the things.
Things we should have: