standard

package
v1.2.41 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHttpHandler added in v1.2.0

func ConvertHttpHandler(h http.Handler) transports.Handler

func ConvertHttpHandlerFunc added in v1.2.0

func ConvertHttpHandlerFunc(h http.HandlerFunc) transports.Handler

func ConvertRequest added in v1.2.0

func ConvertRequest(ctx transports.Request, r *http.Request, forServer bool) error

func HttpTransportHandlerAdaptor

func HttpTransportHandlerAdaptor(h transports.Handler, maxRequestBody int, writeTimeout time.Duration) http.Handler

func New

func New() transports.Transport

func NewHeader

func NewHeader() transports.Header

func WrapHttpHeader

func WrapHttpHeader(h http.Header) transports.Header

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 (c *Client) Close()

func (*Client) Do

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

func (*Client) Key

func (c *Client) Key() (key string)

type ClientConfig

type ClientConfig struct {
	MaxConnsPerHost       int          `json:"maxConnsPerHost"`
	MaxResponseHeaderSize string       `json:"maxResponseHeaderSize"`
	Timeout               string       `json:"timeout"`
	DisableKeepAlive      bool         `json:"disableKeepAlive"`
	MaxIdleConnsPerHost   int          `json:"maxIdleConnsPerHost"`
	IdleConnTimeout       string       `json:"idleConnTimeout"`
	TLSHandshakeTimeout   string       `json:"tlsHandshakeTimeout"`
	ExpectContinueTimeout string       `json:"expectContinueTimeout"`
	Dialer                DialerConfig `json:"dialer"`
	IsTLS                 bool         `json:"isTLS"`
	TLSConfig             *tls.Config  `json:"-"`
	TLSDialer             ssl.Dialer   `json:"-"`
}

func (*ClientConfig) ExpectContinueTimeoutDuration

func (config *ClientConfig) ExpectContinueTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) IdleConnTimeoutDuration

func (config *ClientConfig) IdleConnTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) MaxConnectionsPerHost

func (config *ClientConfig) MaxConnectionsPerHost() (n int)

func (*ClientConfig) MaxIdleConnectionsPerHost

func (config *ClientConfig) MaxIdleConnectionsPerHost() (n int)

func (*ClientConfig) MaxResponseHeaderByteSize

func (config *ClientConfig) MaxResponseHeaderByteSize() (n uint64, err error)

func (*ClientConfig) TLSHandshakeTimeoutDuration

func (config *ClientConfig) TLSHandshakeTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) TimeoutDuration

func (config *ClientConfig) TimeoutDuration() (n time.Duration, err error)

type Config

type Config struct {
	MaxRequestHeaderSize string        `json:"maxRequestHeaderSize"`
	MaxRequestBodySize   string        `json:"maxRequestBodySize"`
	ReadTimeout          string        `json:"readTimeout"`
	ReadHeaderTimeout    string        `json:"readHeaderTimeout"`
	WriteTimeout         string        `json:"writeTimeout"`
	IdleTimeout          string        `json:"idleTimeout"`
	Client               *ClientConfig `json:"client"`
}

func (*Config) ClientConfig

func (config *Config) ClientConfig() *ClientConfig

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 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.Context
	// contains filtered or unexported fields
}

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 ResponseWriter added in v1.1.2

type ResponseWriter struct {
	context.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) 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