Versions in this module Expand all Collapse all v1 v1.0.0 Dec 22, 2019 Changes in this version + const ConnectDialTimeout + const DefaultConcurrency + const DefaultHTTPTImeout + const DefaultReadBufferSize + const DefaultReadTimeout + const DefaultTLSCertCacheSize + const DefaultWriteBufferSize + const DefaultWriteTimeout + const MaxConnsPerHost + var ErrProxyAuthorization = xerrors.New("cannot authenticate proxy user") + func ExecuteRequest(client HTTPRequestExecutor, req *fasthttp.Request, resp *fasthttp.Response) + func ExecuteRequestTimeout(client HTTPRequestExecutor, req *fasthttp.Request, resp *fasthttp.Response, ...) + func ExtractAuthentication(text []byte) ([]byte, []byte, error) + func HTTPExecutor(state *LayerState) + func MakeProxyAuthorizationHeaderValue(proxyURL *url.URL) []byte + func MakeSimpleResponse(resp *fasthttp.Response, msg string, statusCode int) + func ParseHeaders(hset *HeaderSet, rawHeaders []byte) error + type AddRemoveHeaderLayer struct + AbsentRequestHeaders []string + AbsentResponseHeaders []string + DefaultRequestHeaders map[string]string + DefaultResponseHeaders map[string]string + FrozenRequestHeaders map[string]string + FrozenResponseHeaders map[string]string + func (a *AddRemoveHeaderLayer) OnRequest(state *LayerState) error + func (a *AddRemoveHeaderLayer) OnResponse(state *LayerState, err error) + type Executor func(*LayerState) + func MakeProxyChainExecutor(proxyURL *url.URL) (Executor, error) + type HTTPRequestExecutor interface + Do func(*fasthttp.Request, *fasthttp.Response) error + DoTimeout func(*fasthttp.Request, *fasthttp.Response, time.Duration) error + func MakeDefaultCONNECTProxyClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeDefaultHTTPClient() HTTPRequestExecutor + func MakeDefaultHTTPProxyClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeDefaultSOCKS5ProxyClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingClosingCONNECTHTTPClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingClosingHTTPClient() HTTPRequestExecutor + func MakeStreamingClosingProxyHTTPClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingClosingSOCKS5HTTPClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingReuseCONNECTHTTPClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingReuseHTTPClient() HTTPRequestExecutor + func MakeStreamingReuseProxyHTTPClient(proxyURL *url.URL) HTTPRequestExecutor + func MakeStreamingReuseSOCKS5HTTPClient(proxyURL *url.URL) HTTPRequestExecutor + type Header struct + ID string + Key []byte + Value []byte + func (h *Header) String() string + type HeaderSet struct + func (hs *HeaderSet) Clear() + func (hs *HeaderSet) DeleteBytes(key []byte) + func (hs *HeaderSet) DeleteString(key string) + func (hs *HeaderSet) GetBytes(key []byte) ([]byte, bool) + func (hs *HeaderSet) GetString(key string) (string, bool) + func (hs *HeaderSet) Items() []*Header + func (hs *HeaderSet) SetBytes(key []byte, value []byte) + func (hs *HeaderSet) SetString(key, value string) + func (hs *HeaderSet) String() string + type Layer interface + OnRequest func(*LayerState) error + OnResponse func(*LayerState, error) + type LayerState struct + ProxyPassword []byte + ProxyUser []byte + RemoteAddr net.Addr + Request *fasthttp.Request + RequestHeaders *HeaderSet + RequestID uint64 + Response *fasthttp.Response + ResponseHeaders *HeaderSet + func (l *LayerState) Delete(key string) + func (l *LayerState) Get(key string) (interface{}, bool) + func (l *LayerState) Set(key string, value interface{}) + type LogTracer struct + func (l *LogTracer) Clear() + func (l *LogTracer) Dump(state *LayerState, logger Logger) + func (l *LogTracer) FinishExecute() + func (l *LogTracer) FinishOnRequest(err error) + func (l *LogTracer) FinishOnResponse() + func (l *LogTracer) StartExecute() + func (l *LogTracer) StartOnRequest() + func (l *LogTracer) StartOnResponse() + type Logger interface + Debug func(string, ...interface{}) + Error func(string, ...interface{}) + Info func(string, ...interface{}) + Panic func(string, ...interface{}) + Warn func(string, ...interface{}) + type Metrics interface + DropCertificate func() + DropConnect func() + DropConnection func() + DropDelete func() + DropGet func() + DropHead func() + DropOptions func() + DropOther func() + DropPatch func() + DropPost func() + DropPut func() + DropTrace func() + NewCertificate func() + NewConnect func() + NewConnection func() + NewDelete func() + NewGet func() + NewHead func() + NewOptions func() + NewOther func() + NewPatch func() + NewPost func() + NewPut func() + NewTrace func() + type NoopLogger struct + func (n *NoopLogger) Debug(_ string, _ ...interface{}) + func (n *NoopLogger) Error(_ string, _ ...interface{}) + func (n *NoopLogger) Info(_ string, _ ...interface{}) + func (n *NoopLogger) Panic(msg string, args ...interface{}) + func (n *NoopLogger) Warn(_ string, _ ...interface{}) + type NoopMetrics struct + func (n *NoopMetrics) DropCertificate() + func (n *NoopMetrics) DropConnect() + func (n *NoopMetrics) DropConnection() + func (n *NoopMetrics) DropDelete() + func (n *NoopMetrics) DropGet() + func (n *NoopMetrics) DropHead() + func (n *NoopMetrics) DropOptions() + func (n *NoopMetrics) DropOther() + func (n *NoopMetrics) DropPatch() + func (n *NoopMetrics) DropPost() + func (n *NoopMetrics) DropPut() + func (n *NoopMetrics) DropTrace() + func (n *NoopMetrics) NewCertificate() + func (n *NoopMetrics) NewConnect() + func (n *NoopMetrics) NewConnection() + func (n *NoopMetrics) NewDelete() + func (n *NoopMetrics) NewGet() + func (n *NoopMetrics) NewHead() + func (n *NoopMetrics) NewOptions() + func (n *NoopMetrics) NewOther() + func (n *NoopMetrics) NewPatch() + func (n *NoopMetrics) NewPost() + func (n *NoopMetrics) NewPut() + func (n *NoopMetrics) NewTrace() + type NoopTracer struct + func (n *NoopTracer) Clear() + func (n *NoopTracer) Dump(_ *LayerState, _ Logger) + func (n *NoopTracer) FinishExecute() + func (n *NoopTracer) FinishOnRequest(_ error) + func (n *NoopTracer) FinishOnResponse() + func (n *NoopTracer) StartExecute() + func (n *NoopTracer) StartOnRequest() + func (n *NoopTracer) StartOnResponse() + type ProxyAuthorizationBasicLayer struct + Password []byte + Realm string + User []byte + func (p *ProxyAuthorizationBasicLayer) MakeProxyAuthRequiredResponse(state *LayerState) + func (p *ProxyAuthorizationBasicLayer) OnRequest(state *LayerState) error + func (p *ProxyAuthorizationBasicLayer) OnResponse(state *LayerState, err error) + type Server struct + func NewServer(opts ServerOpts) (*Server, error) + func (s *Server) Serve(ln net.Listener) error + func (s *Server) Shutdown() error + type ServerOpts struct + CertCA []byte + CertKey []byte + Concurrency int + Executor Executor + Layers []Layer + Logger Logger + Metrics Metrics + OrganizationName string + ReadBufferSize int + ReadTimeout time.Duration + TLSCertCacheSize int + TracerPool *TracerPool + WriteBufferSize int + WriteTimeout time.Duration + func (s *ServerOpts) GetCertCA() []byte + func (s *ServerOpts) GetCertKey() []byte + func (s *ServerOpts) GetConcurrency() int + func (s *ServerOpts) GetExecutor() Executor + func (s *ServerOpts) GetLayers() []Layer + func (s *ServerOpts) GetLogger() Logger + func (s *ServerOpts) GetMetrics() Metrics + func (s *ServerOpts) GetOrganizationName() string + func (s *ServerOpts) GetReadBufferSize() int + func (s *ServerOpts) GetReadTimeout() time.Duration + func (s *ServerOpts) GetTLSCertCacheSize() int + func (s *ServerOpts) GetTracerPool() *TracerPool + func (s *ServerOpts) GetWriteBufferSize() int + func (s *ServerOpts) GetWriteTimeout() time.Duration + type StdLogger struct + Log *log.Logger + func (s *StdLogger) Debug(msg string, args ...interface{}) + func (s *StdLogger) Error(msg string, args ...interface{}) + func (s *StdLogger) Info(msg string, args ...interface{}) + func (s *StdLogger) Panic(msg string, args ...interface{}) + func (s *StdLogger) Warn(msg string, args ...interface{}) + type Tracer interface + Clear func() + Dump func(state *LayerState, logger Logger) + FinishExecute func() + FinishOnRequest func(err error) + FinishOnResponse func() + StartExecute func() + StartOnRequest func() + StartOnResponse func() + type TracerCreateFunc func() Tracer + type TracerPool struct + func NewTracerPool(create TracerCreateFunc) *TracerPool Other modules containing this package github.com/9seconds/httransform/v2