client

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 29 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 GorillaFromContext

func GorillaFromContext(ctx context.Context) bool

func UpgradeFromContext

func UpgradeFromContext(ctx context.Context) bool

func VerboseFromContext

func VerboseFromContext(ctx context.Context) bool

func WithGorilla

func WithGorilla(ctx context.Context) context.Context

func WithProtocol

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

func WithUpgrade

func WithUpgrade(ctx context.Context) context.Context

func WithVerbose

func WithVerbose(ctx context.Context) context.Context

Types

type DialOption

type DialOption func(*dialOptions)

func DisableSendPreface

func DisableSendPreface() DialOption

func WithConn

func WithConn(conn net.Conn) DialOption

func WithH2CUpgrade added in v0.1.15

func WithH2CUpgrade() 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)
	WS(ctx context.Context, req *http.Request) 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
	WebSocket
)

func ProtocolFromContext

func ProtocolFromContext(ctx context.Context) HttpProtocol

type VerboseLogger

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

Jump to

Keyboard shortcuts

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