Versions in this module Expand all Collapse all v1 v1.7.4 Mar 1, 2024 Changes in this version + func SafeClose(ch chan struct{}) (closed bool) v1.7.3 Feb 29, 2024 v1.7.2 Feb 29, 2024 v1.7.1 Feb 29, 2024 Changes in this version + func NewStructFromFile[T any](filename string) (*T, error) + type Addon interface + AccessProxyServer func(req *http.Request, res http.ResponseWriter) + ClientConnected func(*ClientConn) + ClientDisconnected func(*ClientConn) + Request func(*Flow) + Requestheaders func(*Flow) + Response func(*Flow) + Responseheaders func(*Flow) + ServerConnected func(*ConnContext) + ServerDisconnected func(*ConnContext) + StreamRequestModifier func(*Flow, io.Reader) io.Reader + StreamResponseModifier func(*Flow, io.Reader) io.Reader + TlsEstablishedServer func(*ConnContext) + type BaseAddon struct + func (addon *BaseAddon) AccessProxyServer(req *http.Request, res http.ResponseWriter) + func (addon *BaseAddon) ClientConnected(*ClientConn) + func (addon *BaseAddon) ClientDisconnected(*ClientConn) + func (addon *BaseAddon) Request(*Flow) + func (addon *BaseAddon) Requestheaders(*Flow) + func (addon *BaseAddon) Response(*Flow) + func (addon *BaseAddon) Responseheaders(*Flow) + func (addon *BaseAddon) ServerConnected(*ConnContext) + func (addon *BaseAddon) ServerDisconnected(*ConnContext) + func (addon *BaseAddon) StreamRequestModifier(f *Flow, in io.Reader) io.Reader + func (addon *BaseAddon) StreamResponseModifier(f *Flow, in io.Reader) io.Reader + func (addon *BaseAddon) TlsEstablishedServer(*ConnContext) + type ClientConn struct + Conn net.Conn + Id uuid.UUID + Tls bool + UpstreamCert bool + func (c *ClientConn) MarshalJSON() ([]byte, error) + type ConnContext struct + ClientConn *ClientConn + FlowCount uint32 + Intercept bool + ServerConn *ServerConn + func (connCtx *ConnContext) Id() uuid.UUID + type Flow struct + ConnContext *ConnContext + Id uuid.UUID + Request *Request + Response *Response + Stream bool + UseSeparateClient bool + func (f *Flow) Done() <-chan struct{} + func (f *Flow) MarshalJSON() ([]byte, error) + type LogAddon struct + func (addon *LogAddon) ClientConnected(client *ClientConn) + func (addon *LogAddon) ClientDisconnected(client *ClientConn) + func (addon *LogAddon) Requestheaders(f *Flow) + func (addon *LogAddon) ServerConnected(connCtx *ConnContext) + func (addon *LogAddon) ServerDisconnected(connCtx *ConnContext) + type Options struct + Addr string + CaRootPath string + Debug int + SslInsecure bool + StreamLargeBodies int64 + Upstream string + type Proxy struct + Addons []Addon + Opts *Options + Version string + func NewProxy(opts *Options) (*Proxy, error) + func (proxy *Proxy) AddAddon(addon Addon) + func (proxy *Proxy) Close() error + func (proxy *Proxy) GetCertificate() x509.Certificate + func (proxy *Proxy) ServeHTTP(res http.ResponseWriter, req *http.Request) + func (proxy *Proxy) SetShouldInterceptRule(rule func(req *http.Request) bool) + func (proxy *Proxy) SetUpstreamProxy(fn func(req *http.Request) (*url.URL, error)) + func (proxy *Proxy) Shutdown(ctx context.Context) error + func (proxy *Proxy) Start() error + type Request struct + Body []byte + Header http.Header + Method string + Proto string + URL *url.URL + func (r *Request) Raw() *http.Request + func (req *Request) MarshalJSON() ([]byte, error) + func (req *Request) UnmarshalJSON(data []byte) error + type Response struct + Body []byte + BodyReader io.Reader + Header http.Header + StatusCode int + func (r *Response) DecodedBody() ([]byte, error) + func (r *Response) IsTextContentType() bool + func (r *Response) ReplaceToDecodedBody() + type ServerConn struct + Address string + Conn net.Conn + Id uuid.UUID + func (c *ServerConn) MarshalJSON() ([]byte, error) + func (c *ServerConn) TlsState() *tls.ConnectionState