Versions in this module Expand all Collapse all v2 v2.0.1 May 2, 2022 v2.0.0 Apr 28, 2022 Changes in this version + const ConnectMitm + const ConnectNone + const ConnectProxy + var DefaultCaCert = []byte(...) + var DefaultCaKey = []byte(...) + var ErrAbsURLAfterCONNECT = NewError("absolute URL after CONNECT") + var ErrNotSupportHTTPVer = NewError("http version not supported") + var ErrNotSupportHijacking = NewError("hijacking not supported") + var ErrPanic = NewError("panic") + var ErrRemoteConnect = NewError("remote connect") + var ErrRequestRead = NewError("request read") + var ErrResponseWrite = NewError("response write") + var ErrRoundTrip = NewError("round trip") + var ErrTLSHandshake = NewError("TLS handshake") + var ErrTLSSignHost = NewError("TLS sign host") + var ErrUnsupportedTransferEncoding = NewError("unsupported transfer encoding") + func InMemoryResponse(code int, header http.Header, body []byte) *http.Response + func ServeInMemory(w http.ResponseWriter, code int, header http.Header, body []byte) error + func ServeResponse(w http.ResponseWriter, resp *http.Response) error + func SignHosts(ca tls.Certificate, hosts []string) (*tls.Certificate, error) + type CaSigner struct + Ca *tls.Certificate + func NewCaSigner() *CaSigner + func NewCaSignerCache(max int) *CaSigner + func (c *CaSigner) SignHost(host string) (cert *tls.Certificate) + type ConnResponseWriter struct + Conn net.Conn + func NewConnResponseWriter(conn net.Conn) *ConnResponseWriter + func (c *ConnResponseWriter) Close() error + func (c *ConnResponseWriter) Header() http.Header + func (c *ConnResponseWriter) Write(body []byte) (int, error) + func (c *ConnResponseWriter) WriteHeader(statusCode int) + type ConnectAction int + type Context struct + ConnectAction ConnectAction + ConnectHost string + ConnectReq *http.Request + Prx *Proxy + Req *http.Request + SessionNo int64 + SubSessionNo int64 + UserData interface{} + type Error struct + ErrString string + func NewError(errString string) *Error + func (e *Error) Error() string + type Proxy struct + AuthType string + Ca tls.Certificate + MitmChunked bool + OnAccept func(ctx *Context, w http.ResponseWriter, r *http.Request) bool + OnAuth func(ctx *Context, authType string, user string, pass string) bool + OnConnect func(ctx *Context, host string) (ConnectAction ConnectAction, newHost string) + OnError func(ctx *Context, where string, err *Error, opErr error) + OnRequest func(ctx *Context, req *http.Request) (resp *http.Response) + OnResponse func(ctx *Context, req *http.Request, resp *http.Response) + Rt http.RoundTripper + SessionNo int64 + UserData interface{} + func NewProxy() (*Proxy, error) + func NewProxyCert(caCert, caKey []byte) (*Proxy, error) + func (prx *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) Other modules containing this package github.com/go-shortcut/httpproxy