func NewHttpProxy(ser *ProxyServe) *HttpProxy { proxy := new(HttpProxy) proxy.ser = ser proxy.GoProxy = goproxy.NewProxyHttpServer() tr := ser.conf.getTransport() if tr != nil { proxy.GoProxy.Tr = tr } proxy.ctxs = make(map[string]*requestCtx) proxy.GoProxy.OnResponse().DoFunc(proxy.onResponse) return proxy }
func NewHttpProxy(ser *ProxyServe) *HttpProxy { proxy := new(HttpProxy) proxy.ser = ser proxy.GoProxy = goproxy.NewProxyHttpServer() tr := ser.conf.getTransport() if tr != nil { proxy.GoProxy.Tr = tr } proxy.GoProxy.OnRequest().HandleConnectFunc(proxy.onHttpsConnect) proxy.GoProxy.OnRequest().DoFunc(proxy.onRequest) proxy.GoProxy.OnResponse().DoFunc(proxy.onResponse) return proxy }
func NewHttpProxy(ser *ProxyServe) *HttpProxy { proxy := new(HttpProxy) proxy.ser = ser proxy.GoProxy = goproxy.NewProxyHttpServer() tr := ser.conf.getTransport() if tr != nil { proxy.GoProxy.Tr = tr } proxy.ctxs = make(map[string]*requestCtx) if proxy.ser.conf.SslOn { proxy.goproxyMitmConnect = &goproxy.ConnectAction{ Action: goproxy.ConnectMitm, TLSConfig: goproxy.TLSConfigFromCA(&proxy.ser.conf.SslCert), } proxy.GoProxy.OnRequest().HandleConnectFunc(proxy.httpsHandle) } proxy.GoProxy.OnRequest().DoFunc(my_requestHanderFunc) proxy.GoProxy.OnResponse().DoFunc(proxy.onResponse) return proxy }