goproxy
goproxy copied to clipboard
Are eavesdropper and transparent examples outdated?
Hello @elazarl, thanks for your great work!
In both eavesdropper and transparent examples, there are lines showing the usage of HijackConnect
:
https://github.com/elazarl/goproxy/blob/ec485169a1ebac8c90a2f06d00227966db8128bd/examples/goproxy-eavesdropper/main.go#L26-L50
https://github.com/elazarl/goproxy/blob/ec485169a1ebac8c90a2f06d00227966db8128bd/examples/goproxy-transparent/transparent.go#L47-L70
HijackConnect
was introduced in eb7fa0f750cff2a9f14ba93cdb08cab02ecd869d to fix #43, as a workaround to "enable curl -p" like what the comment says.
But in 2efaffc19d4dd684cf21d7c33619cd6f83bf7810, goproxy itself has native support for MITM on plain HTTP tunneling, which means there is no need to manually hijack connect to enable curl -p, as the examples show.
https://github.com/elazarl/goproxy/blob/2efaffc19d4dd684cf21d7c33619cd6f83bf7810/https.go#L111-L167
So here comes the questions:
- I guess just like
AlwaysMitm
AlwaysReject
, maybe there could be aAlwaysHTTPMitm
(orAlwaysHttpMitm
)?
var AlwaysHTTPMitm FuncHttpsHandler = func(host string, ctx *ProxyCtx) (*ConnectAction, string) {
return HTTPMitmConnect, host
}
-
Is it possible to combine the HTTP MITM and HTTPS MITM, so that we package users don't have to use regexp to distinguish them and set HttpsHandlers separately? (I remember reading about this in another issue here, but can't find it now.)
-
For eavesdropper: HijackConnect part seems to be broken, and can be replaced with something like AlwaysHTTPMitm or removed to improve clarity and avoid confusion for newcomers.
-
For transparent: Does a transparent proxy need to handle (or even hijack) CONNECT? In my humble opinion not.
I'm willing to help but afraid if I don't get the original idea in the examples. Sorry for having so many messy ideas and questions to bother.