client

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
)

Variables

View Source
var (
	ErrHTTP2Unsupported = errors.New("unsupported protocol http2")
)

Functions

func DecodeGrpcPayload

func DecodeGrpcPayload(data []byte) ([]byte, error)

func EncodeGrpcPayload

func EncodeGrpcPayload(payload []byte) []byte

func VerboseFromContext

func VerboseFromContext(ctx context.Context) bool

func WithProtocol

func WithProtocol(ctx context.Context, protocol HttpProtocol) context.Context

func WithVerbose

func WithVerbose(ctx context.Context) context.Context

Types

type DialOption

type DialOption func(*dialOptions)

func WithConn

func WithConn(conn net.Conn) DialOption

func WithTLS

func WithTLS() DialOption

func WithTimeout

func WithTimeout(timeout time.Duration) DialOption

type Fetcher

type Fetcher interface {
	Do(context.Context, *http.Request) (*http.Response, error)
	CallGRPC(ctx context.Context, serviceURL *url.URL, req, res proto.Message) error
	Close() error
}

func NewFetcher

func NewFetcher() Fetcher

type HttpProtocol

type HttpProtocol uint8
const (
	Unknown HttpProtocol = iota
	HTTP2
	HTTP1
	HTTP10
	HTTP11
)

func ProtocolFromContext

func ProtocolFromContext(ctx context.Context) HttpProtocol

type VerboseLogger

type VerboseLogger interface {
	Printf(format string, v ...any)
}

Jump to

Keyboard shortcuts

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