fast

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() transports.Transport

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(address string, config ClientConfig) (client *Client, err error)

func (*Client) Close

func (client *Client) Close()

func (*Client) Do

func (client *Client) Do(ctx context.Context, method []byte, path []byte, header transports.Header, body []byte) (status int, responseHeader transports.Header, responseBody []byte, err error)

type ClientConfig

type ClientConfig struct {
	DialDualStack             bool         `json:"dialDualStack"`
	MaxConnsPerHost           int          `json:"maxConnsPerHost"`
	MaxIdleConnDuration       string       `json:"maxIdleConnDuration"`
	MaxConnDuration           string       `json:"maxConnDuration"`
	MaxIdemponentCallAttempts int          `json:"maxIdemponentCallAttempts"`
	ReadBufferSize            string       `json:"readBufferSize"`
	ReadTimeout               string       `json:"readTimeout"`
	WriteBufferSize           string       `json:"writeBufferSize"`
	WriteTimeout              string       `json:"writeTimeout"`
	MaxResponseBodySize       string       `json:"maxResponseBodySize"`
	MaxConnWaitTimeout        string       `json:"maxConnWaitTimeout"`
	Dialer                    DialerConfig `json:"dialer"`
	IsTLS                     bool         `json:"isTLS"`

	TLSConfig *tls.Config `json:"-"`
	TLSDialer ssl.Dialer  `json:"-"`
	// contains filtered or unexported fields
}

type ClientHttp2Config

type ClientHttp2Config struct {
	Enabled            bool `json:"enabled"`
	PingSeconds        int  `json:"pingSeconds"`
	MaxResponseSeconds int  `json:"maxResponseSeconds"`
}

type Config

type Config struct {
	ReadBufferSize        string       `json:"readBufferSize"`
	ReadTimeout           string       `json:"readTimeout"`
	WriteBufferSize       string       `json:"writeBufferSize"`
	WriteTimeout          string       `json:"writeTimeout"`
	MaxIdleWorkerDuration string       `json:"maxIdleWorkerDuration"`
	TCPKeepalive          bool         `json:"tcpKeepalive"`
	TCPKeepalivePeriod    string       `json:"tcpKeepalivePeriod"`
	MaxRequestBodySize    string       `json:"maxRequestBodySize"`
	ReduceMemoryUsage     bool         `json:"reduceMemoryUsage"`
	MaxRequestsPerConn    int          `json:"maxRequestsPerConn"`
	KeepHijackedConns     bool         `json:"keepHijackedConns"`
	StreamRequestBody     bool         `json:"streamRequestBody"`
	Prefork               bool         `json:"prefork"`
	Http2                 Http2Config  `json:"http2"`
	Client                ClientConfig `json:"client"`
}

type Context added in v1.1.2

type Context struct {
	*fasthttp.RequestCtx
	// contains filtered or unexported fields
}

func (*Context) LocalValue added in v1.1.2

func (ctx *Context) LocalValue(key []byte) any

func (*Context) LocalValues added in v1.2.0

func (ctx *Context) LocalValues(fn func(key []byte, val any))

func (*Context) RemoveLocalValue added in v1.2.85

func (ctx *Context) RemoveLocalValue(key []byte)

func (*Context) RemoveUserValue added in v1.2.85

func (ctx *Context) RemoveUserValue(key []byte)

func (*Context) SetLocalValue added in v1.1.2

func (ctx *Context) SetLocalValue(key []byte, val any)

func (*Context) SetUserValue added in v1.1.2

func (ctx *Context) SetUserValue(key []byte, val any)

func (*Context) UserValue added in v1.1.2

func (ctx *Context) UserValue(key []byte) any

func (*Context) UserValues added in v1.1.2

func (ctx *Context) UserValues(fn func(key []byte, val any))

type Dialer

type Dialer struct {
	// contains filtered or unexported fields
}

func NewDialer

func NewDialer(opts ClientConfig) (dialer *Dialer, err error)

func (*Dialer) Close

func (dialer *Dialer) Close()

func (*Dialer) Dial

func (dialer *Dialer) Dial(addressBytes []byte) (client transports.Client, err error)

type DialerConfig added in v1.2.21

type DialerConfig struct {
	CacheSize     int `json:"cacheSize"`
	ExpireSeconds int `json:"expireSeconds"`
}

type Http2Config

type Http2Config struct {
	Enable               bool `json:"enable"`
	PingSeconds          int  `json:"pingSeconds"`
	MaxConcurrentStreams int  `json:"maxConcurrentStreams"`
	MaxResponseSeconds   int  `json:"maxResponseSeconds"`
}

type Params

type Params struct {
	// contains filtered or unexported fields
}

func (*Params) Add

func (params *Params) Add(name []byte, value []byte)

func (*Params) Encode

func (params *Params) Encode() (p []byte)

func (*Params) Get

func (params *Params) Get(name []byte) []byte

func (*Params) Len

func (params *Params) Len() int

func (*Params) Remove

func (params *Params) Remove(name []byte)

func (*Params) Set

func (params *Params) Set(name []byte, value []byte)

func (*Params) Values

func (params *Params) Values(name []byte) [][]byte

type Request

type Request struct {
	*Context
}

func (*Request) Body

func (r *Request) Body() ([]byte, error)

func (*Request) Cookie

func (r *Request) Cookie(key []byte) (value []byte)

func (*Request) FormValue added in v1.1.1

func (r *Request) FormValue(name []byte) (value []byte)

func (*Request) Header

func (r *Request) Header() transports.Header

func (*Request) Host

func (r *Request) Host() []byte

func (*Request) Method

func (r *Request) Method() []byte

func (*Request) Params

func (r *Request) Params() transports.Params

func (*Request) Path

func (r *Request) Path() []byte

func (*Request) Proto

func (r *Request) Proto() []byte

func (*Request) RemoteAddr

func (r *Request) RemoteAddr() []byte

func (*Request) RequestURI added in v1.1.3

func (r *Request) RequestURI() []byte

func (*Request) SetBody

func (r *Request) SetBody(body []byte)

func (*Request) SetCookie

func (r *Request) SetCookie(key []byte, value []byte)

func (*Request) SetMethod

func (r *Request) SetMethod(method []byte)

func (*Request) TLS

func (r *Request) TLS() bool

func (*Request) TLSConnectionState

func (r *Request) TLSConnectionState() *tls.ConnectionState

type RequestHeader

type RequestHeader struct {
	// contains filtered or unexported fields
}

func (RequestHeader) Add

func (h RequestHeader) Add(key []byte, value []byte)

func (RequestHeader) Del

func (h RequestHeader) Del(key []byte)

func (RequestHeader) Foreach

func (h RequestHeader) Foreach(fn func(key []byte, values [][]byte))

func (RequestHeader) Get

func (h RequestHeader) Get(key []byte) []byte

func (RequestHeader) Len

func (h RequestHeader) Len() int

func (RequestHeader) Reset

func (h RequestHeader) Reset()

func (RequestHeader) Set

func (h RequestHeader) Set(key []byte, value []byte)

func (RequestHeader) Values

func (h RequestHeader) Values(key []byte) [][]byte

type ResponseHeader

type ResponseHeader struct {
	*fasthttp.ResponseHeader
}

func (*ResponseHeader) Add

func (h *ResponseHeader) Add(key []byte, value []byte)

func (*ResponseHeader) Del

func (h *ResponseHeader) Del(key []byte)

func (*ResponseHeader) Foreach

func (h *ResponseHeader) Foreach(fn func(key []byte, values [][]byte))

func (*ResponseHeader) Get

func (h *ResponseHeader) Get(key []byte) []byte

func (*ResponseHeader) Len

func (h *ResponseHeader) Len() int

func (*ResponseHeader) Reset

func (h *ResponseHeader) Reset()

func (*ResponseHeader) Set

func (h *ResponseHeader) Set(key []byte, value []byte)

func (*ResponseHeader) Values

func (h *ResponseHeader) Values(key []byte) [][]byte

type ResponseWriter added in v1.1.2

type ResponseWriter struct {
	*Context
	// contains filtered or unexported fields
}

func (*ResponseWriter) Body added in v1.1.2

func (w *ResponseWriter) Body() []byte

func (*ResponseWriter) BodyLen added in v1.1.2

func (w *ResponseWriter) BodyLen() int

func (*ResponseWriter) Failed added in v1.1.2

func (w *ResponseWriter) Failed(cause error)

func (*ResponseWriter) Header added in v1.1.2

func (w *ResponseWriter) Header() transports.Header

func (*ResponseWriter) Hijack added in v1.1.2

func (w *ResponseWriter) Hijack(f func(ctx context.Context, conn net.Conn, rw *bufio.ReadWriter) (err error)) (async bool, err error)

func (*ResponseWriter) Hijacked added in v1.1.2

func (w *ResponseWriter) Hijacked() bool

func (*ResponseWriter) ResetBody added in v1.2.63

func (w *ResponseWriter) ResetBody()

func (*ResponseWriter) SetCookie added in v1.1.2

func (w *ResponseWriter) SetCookie(cookie *transports.Cookie)

func (*ResponseWriter) SetStatus added in v1.1.2

func (w *ResponseWriter) SetStatus(status int)

func (*ResponseWriter) Status added in v1.1.2

func (w *ResponseWriter) Status() int

func (*ResponseWriter) Succeed added in v1.1.2

func (w *ResponseWriter) Succeed(v interface{})

func (*ResponseWriter) Write added in v1.1.2

func (w *ResponseWriter) Write(body []byte) (int, error)

func (*ResponseWriter) WriteDeadline added in v1.1.2

func (w *ResponseWriter) WriteDeadline() time.Time

func (*ResponseWriter) WriteTimeout added in v1.1.2

func (w *ResponseWriter) WriteTimeout() time.Duration

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe() (err error)

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) (err error)

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

func (*Transport) Construct

func (tr *Transport) Construct(options transports.Options) (err error)

func (*Transport) Dial

func (tr *Transport) Dial(address []byte) (client transports.Client, err error)

func (*Transport) ListenAndServe

func (tr *Transport) ListenAndServe() (err error)

func (*Transport) Name

func (tr *Transport) Name() (name string)

func (*Transport) Port

func (tr *Transport) Port() (port int)

func (*Transport) Shutdown

func (tr *Transport) Shutdown(ctx context.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL